nexus
2 years ago
193
1
Laravel

Assign unserialize Laravel object to JS array

Posted 2 years ago by nexus

I have serialize object returning from Controller to blade view in laravel like:

a:3:{i:0;s:1:"2";i:1;s:1:"4";i:2;s:1:"6";}"

from my blade view I use this JS code block to get those value as array.

var branches = {{unserialize($preliminary->branches)}};

But in there I'm getting error saying

expression expected

any suggestions to solve this situation..?

Please sign in or create an account to participate in this conversation.