@sinnbeck Second method is not working. The first method is okay but my code is like messed up and have something like (") in the code that cause failed to load in js.
Here is my partial code. Do i have to decode or encode something before i pass to view?
@sinnbeck Actually i wanted to do something like key and value thing with multiple values. Then pass it to js to loop it and populate the data and imgUrl for dropzone to display image.
Well when you pass an array to json_encode it converts 0 indexed arrays to javascript arrays and associative arrays to javascript objects
That means your output will be something like
[
{
size: 20, //replace with actual value
url: http://imadasjdk.com/jds.jpg'', //replace with actual value
},
{
size: 55, //replace with actual value
url: http://imadasjdk.com/dsadasdasdsad.jpg'', //replace with actual value
},
]
@sinnbeck So i have to convert my data to associative arrays from controller then json_encode at js ?
This is what i got from js code.
var method = [{"size":41718,"url":"85\/1qc9FO180s6RYjPVmB4REz88ihfVgRtzhbqbYPMf.png"},{"size":5711,"url":"85\/iEms77w50M3rZFfS8Ck5N5p0L9IcuODoA2IvYx3R.png"},{"size":21252,"url":"85\/Z6fTfz3altsXlBeJs66mNhpsVzzh1AgmasNPZKug.png"}];