jquery - javaScript Convert String Array to Array -


i have response php this

"['console.log(\"ok ok \")','console.log(\"pagelet.js loaded\")','','']" 

its array string how can convert array

i thinking about

split ,

but must remove []
if body have idea please write :)

also idea

new function

and

parse

but dont want use them if there none idea use them

this simpler not putting function calls in string data , using object properties accomplish same thing using client side logic

json

[{"log": "ok ok"},{"log": "pagelet.js loaded"},{"log":false},{"log":false}] 

js (after parsing json)

$.each(serverarray, function(_, item){    if(item.log){        console.log(item.log);    } }); 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -