Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created July 15, 2011 18:35
Show Gist options
  • Select an option

  • Save mhulse/1085246 to your computer and use it in GitHub Desktop.

Select an option

Save mhulse/1085246 to your computer and use it in GitHub Desktop.
PHP test for an ajax request.
<?php
function is_ajax() {
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') ? TRUE : FALSE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment