Sometimes it is necessary to determine if a request was performed by a jQuery Ajax call or a normal request. Using ajaxSetup it is possible to add custom headers to all Ajax requests executed by jQuery.
$.ajaxSetup({
'beforeSend': function(xhr) {
xhr.setRequestHeader("AJAX", "true");
}
});
Server-side you can then check the request header to identify the type of request and output the appropriate response.
