Muhammad Usman wrote a tutorial on how to write an HTTP Middleware which detects Ajax requests and converts responses to Ajax compatible responses.

ajax laravel