Skip to content

Instantly share code, notes, and snippets.

@fabiocicerchia
Created February 25, 2012 08:27
Show Gist options
  • Save fabiocicerchia/1907336 to your computer and use it in GitHub Desktop.
Save fabiocicerchia/1907336 to your computer and use it in GitHub Desktop.
PHP - Check if a request is really AJAX
<?php
function is_ajax() {
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment