开发者

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"}
  ]
};
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜