samedi 14 avril 2018

Uncaught SyntaxError: Unexpected token ! - Laravel array

I have a problem with my project. I'm trying to pass an array from controller to js file and I getting this message - "Uncaught SyntaxError: Unexpected token !".

JS CODE:

 var attractionList = {!! json_encode($attractionList->toArray()) !!};

Controller CODE:

return view('TripBuilder/showTrip',[
            "attractionList" => $attractionsListPerDay,
            "num_of_days" => count($attractionsListPerDay)
            ]);

Please help!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire