Return to Snippet

Revision: 43613
at March 28, 2011 04:07 by supermauerbros


Initial Code
/* 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.... */

Initial URL
http://davidwalsh.name/detect-ajax

Initial Description

                                

Initial Title
Test for AJAX Header in PHP

Initial Tags
ajax, php, header, jquery

Initial Language
PHP