Returns true if the request is a XMLHttpRequest.
It works if your JavaScript library set an X-Requested-With HTTP header. It is known to work with Prototype, Mootools, jQuery.
@api
Boolean true if the request is an XMLHttpRequest, false otherwise
public function isXmlHttpRequest() {
return 'XMLHttpRequest' == $this->headers
->get('X-Requested-With');
}