Add an utility to check for Ajax-Requests

This change adds a tiny function `is_xhr` which checks the headers of the request for `X-Requested-With`, containing `XMLHttpRequest`, which is usually set by browsers when using the `XMLHttpRequest` object. I have found this function useful when writing up an API. Perhaps it's a good idea to add it for others, too.