How can i check the request is ajax in laravel framework.
You can easily check the request is ajax or not. First you paste the below line into the top of the controller page.
This is the sample code
You can easily check the request is ajax or not. First you paste the below line into the top of the controller page.
use Illuminate\Http\Request;
This is the sample code
public function SomeFunction(Request $HTTPRequest)
{
if($HTTPRequest->ajax())
{
//Yes it is an ajax request
}
else
{
//It is not an ajax request
}
}
{
if($HTTPRequest->ajax())
{
//Yes it is an ajax request
}
else
{
//It is not an ajax request
}
}
No comments:
Post a Comment