Support the ongoing development of Laravel.io →
Requests Blade
Last updated 1 year ago.
0

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);
}
0

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)"?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.