Skip to content

Instantly share code, notes, and snippets.

@sumitpore
Created April 17, 2019 11:16
Show Gist options
  • Select an option

  • Save sumitpore/73ec89098f4c5ac4f9befcaca89b7287 to your computer and use it in GitHub Desktop.

Select an option

Save sumitpore/73ec89098f4c5ac4f9befcaca89b7287 to your computer and use it in GitHub Desktop.
Check if Ajax Request in PHP
<?php
if ( !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' )
{
# Ex. check the query and serve requested data
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment