I have one script use for both ajax and normal request.
This code can help you detect ajax request to coding.
This code can help you detect ajax request to coding.
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { /* special ajax here */ }