Cannot Get JSON for the JavaScript Object -
this question has answer here:
- javascript associative array json 4 answers
i'm creating js object
var eledetailstop = new array(); var j = 0; var id = "ele"+j; eledetailstop[id] = {id: id, size : "40%", sizelabel : 12, type : "image", title : "image"}; now, i'm trying convert object json...
var fields = json.stringify(eledetailstop); so, problem is, gives empty result.
here got when debugged firebug
as can see there object called wrappedjsobject inside this. if checked inside it, can see wrappedjsobject on...
why ? why weird ?
you're creating array , assigning alphanumeric property. try this:
var j = 0; var id = "ele"+j; eledetailstop[j] = {id: id, size : "40%", sizelabel : 12, type : "image", title : "image"}; edit: if want use id property - defined eledetailstop object:
var eledetailstop = {}; 
Comments
Post a Comment