Return to Snippet

Revision: 31071
at August 28, 2010 15:38 by joshuascott94


Initial Code
function isAjax() {
   return (isset($_SERVER['HTTP_X_REQUESTED_WITH'])
              &&
            ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'));
}

Initial URL
http://www.gmarwaha.com/blog/category/client-side/javascript/

Initial Description
Quick and easy way to determine if the HTTP request is an AJAX call or a standard call.  Supports the notion of Unobtrusive JavaScript.

Initial Title
Check if request is AJAX request

Initial Tags
http, ajax, header

Initial Language
PHP