Try using {!! !!} ( note the single { with 2 ! )
Dec 13, 2015
2
Level 2
from json to javascript in blade
I want to pass a variable to javascript, from Blade my variable does have the correct format : [{"keyA":"ValueA"},{"keyB":"valueB"},{etc.}]
then, I do this var myVariable = {{$myVariable}} this does: myVariable = [{AndQuot;keyAAndQuot; ...etc. }] (htmlentities)
so I do this: var myVariable = {{!!$myVariable!!}} and curly braces get added : var myVariable = {[{"keyA":"ValueA"},{"keyB":"valueB"},{etc.}]}
there must be something simple to do, that I am just missing...
Level 53
3 likes
Please or to participate in this conversation.