I noticed this odd PHP function in an article about AJAX and Prototype:
http://www.sitepoint.com/article/pai...pt-prototype/2
Prototype adds a custom HTTP header to all its AJAX requests so that your server
application can detect that it's an AJAX call, rather than a normal call. The header is:
X-Requested-With: XMLHttpRequest
Here's an example PHP function used to detect an AJAX call:
function isAjax() {
return isset($_SERVER['HTTP_X_REQUESTED_WITH']) &&
$_SERVER ['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
}
Most of the AJAX calls I've seen are GET or POST, so I expect them to
show up in the $_GET or $_POST arrays. Why would this header show up in
the $_SERVER array?