Created
May 7, 2012 13:05
-
-
Save mazhar266/8c4e50f54fbff48f3d2d to your computer and use it in GitHub Desktop.
detect ajax call
This file contains 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
<?php | |
/* decide what the content should be up here .... */ | |
$content = get_content(); //generic function; | |
/* AJAX check */ | |
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { | |
/* special ajax here */ | |
die($content); | |
} | |
/* not ajax, do more.... */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment