Created
May 8, 2019 23:02
-
-
Save sjordan1975/aa84bbf84818d5858d4d4ad4fd3e872c to your computer and use it in GitHub Desktop.
[isAjax Request] Is the incoming request an ajax request #php #ajax
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
| define('__ERROR__', -1); | |
| define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); | |
| // if this page is not being accessed via AJAX, return error | |
| if (!IS_AJAX){ | |
| echo __ERROR__; | |
| exit; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment