How to constructing Javascript Array with predefined format
From AJAX Call i am constructing this data in my server
{data:[{one:"1",two:"2"},{one:"3",two:"3"}]}
I am able to access this data using data.jobs[2].one;
My question is that , is it possible to construct a similar array inside javascript also I mean this way :
var data = [{one:1,two:2},{one:开发者_JAVA技巧3,two:3}];
Please help , thank you very much
To access a value using data.jobs[2].one
you would need a structure like this:
var data = {
jobs:[
{one:"1",two:"2"},
{one:"3",two:"3"}
]
};
精彩评论