How to check request is Ajax or not in Laravel 5?By Hardik Savani | August 13, 2016 | | 1245 Viewer | Category : Laravel Ajax
Share this post:
Sometimes, we need to check request is ajax or not in laravel 5. If you want to call same method but if request is ajax then you perform different, then you can do by using $request object.
In Laravel 5 $request object provide method to check request is ajax or not, In following example you can see how it's works.
You can check directly from Request facade and also from request object, both are same, so let's see bellow example.
public function index(Request $request)
public function index()
- Laravel 5 - Orderby random using rand() and DB::raw() example
- Laravel 5.3 - How to create SEO friendly sluggable URL
- Laravel 5 Join with subquery in Query Builder Example
- How to send mail example in Laravel 5?
- Laravel 5 - How to prevent browser back button after user logout?
- How to check request method is GET or POST in Laravel?
- How to add charts in Laravel 5 using Highcharts ?
- Laravel 5 - Image Upload and Resize Example using Intervention Image Package