Skip to content
Advertisement

Console.log does not show result based on variable value

I’m using Laravel 5.8 and in this project, I wanted to show some results in Javascript based on the variable which is sent to View.

So at the Controller, I have added this:

JavaScript

Then at the view:

JavaScript

So basically, if title does not have any value, it should be showing 1 at the Console bar, otherwise 2 must be appears.

But the problem is, it does not show anything at all!

So what’s going wrong out there? How can I properly get the result based on this variable value?

Advertisement

Answer

in controller

JavaScript

in blade

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement