Skip to content

Instantly share code, notes, and snippets.

@cointilt
Created February 28, 2010 23:29
Show Gist options
  • Save cointilt/317914 to your computer and use it in GitHub Desktop.
Save cointilt/317914 to your computer and use it in GitHub Desktop.
Is Requested by Ajax
<?php /* Git it! */
/**
* Is Requested by Ajax
* @return boolean
*/
function is_ajax()
{
return ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) and ( 'xmlhttprequest' == strtolower ( $_SERVER['HTTP_X_REQUESTED_WITH'] ) or 'activexobject' == strtolower ( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) ) ?: false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment