Skip to content
Advertisement

Laravel 5 echo out session variable containing html in blade

I did a redirect in laravel:

JavaScript

$returnData is a string that contains a bootstrap info div with the result from the controller. Almost everything is working except when the page loads again it shows the html on the page as if it were text, brackets and everything. If I use this:

JavaScript

Then it shows is as pure text. If I change it to

JavaScript

It works fine. Im ok keeping it like this but I would rather utilize Blade / Laravel as its supposed to be used so I was wondering if there is a way to have the @if statement show the rendered html and not the text version?

Advertisement

Answer

I would recommend returning just the error message then in your view create the div. So if you were to change the layout of the view, you would it in one place.

JavaScript

hope this help.

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