Created
July 19, 2015 21:07
-
-
Save davidkevork/d68424acb950416a3853 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* it will detect whether the request is in Ajax or no | |
*/ | |
function IsAjax() | |
{ | |
if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { | |
// checking $_SERVER['HTTP_X_REQUESTED_WITH'] is exist so no error outputs if it is not set | |
if (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') { | |
return true; | |
} | |
} else { | |
return false; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment