Javascript printing to html with percent sign -


i bunch of json data through xhr request, , following data back:

{"data_list" : [[1, "title1", "0.54%"], [2, "title2", "2.98%"]]} 

then try loop through data, , put in console console.log:

var len = json.data_list.length; for(var = 0; < len; i++) {    console.log(json.data_list[i]); } 

but don't same percentages:

[1, "title1", "0.24%"] [2, "title2", "0.00%"]  

anyone know why right data first 2 fields, not same percentages? if take out percent signs in json response, still wrong numbers.

assume variable valid, i'm using library maps json variable json.data_list.

i not bright

somewhere xhr request got mangled dojo. help!

"data-list" invalid identifier expect act, it's interpreted subtraction. try using bracket notation:

json["data-list"].length 

and

json["data-list"][i] 

demo: http://jsfiddle.net/7bgvv/


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -