How to check request is Ajax or not in Laravel 5?By Hardik Savani | August 13, 2016 | | 33317 Viewer| Category : LaravelAjax
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()
- How to get last record from MySQL table in Codeigniter?
- How to get last 2 days records from table using Mysql Query?
- How to create scroll to top of the page by jquery animate ?
- How to get folder path from file path in PHP?
- How to convert array key to lowercase in PHP?
- Codeigniter 3 - select2 ajax autocomplete from database example with demo
- Laravel 5 json response from controller example
- PHP - jquery datatables with mysql database example from scratch