Checking an Ajax request on the server is a task which can be done with the help of input class method. If there has been an Ajax request on the server, then the function, Input::is_ajax will return true, and in the otherwise case, it will return false.
Example
if (Input::is_ajax()) {
// Ajax request
} else {
// Normal request
}