Last active
December 11, 2015 08:36
-
-
Save stefket/0da939b93e31d4f3061b to your computer and use it in GitHub Desktop.
Check if ajax request
This file contains hidden or 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 | |
| /** | |
| * @return boolean | |
| */ | |
| function is_ajax() | |
| { | |
| if (!isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { | |
| return false; | |
| } | |
| return strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment