Where a page is being accessed by AJAX it will post data using XML, PHP can then pick up on the HTTP request and see what the return is expecting. For this you just need to use the PHP server variable and grab the parameter HTTP_X_Requested_With.
For this you just need to use the PHP server variable and grab the parameter HTTP_X_Requested_With.
$_SERVER['HTTP_X_REQUESTED_WITH']
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { From Ajax }else{ Not Ajax }
No comments:
Post a Comment