I would probably use two different view files - one for ajax, one for the non ajax, so in your controller
if($ajax)
{
return view('ajax', $data);
}else{
return view('not-ajax', $data);
}
It seems like your call to "if ($ajax)" worked as expected and "if ($ajax == false)" did not. You can print out or dd $ajax to see what values it is having.
You could use "@else" instead of making two if statements.
Did you try "if (! $ajax)"?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community