开发者

Problem appending options to a select from a JSON object

I have this Json from a $.getJson function:

[
    {"UserName":"Z1","FullName":"XY1"},
    {"UserName":"Z2","FullName":"XY2"},
    {"UserName":"Z3","FullName":"XY3"}
]

I try to append these into options of a select tag as a pair of value end text. I've tried this:

$.each(data, function(i,item) {
  alert(item.UserName + " " + item.FullName);
});

but it gave me: undefined undefined.

开发者_开发技巧

I think it should work. What's wrong?


Seems to be working fine here: http://jsfiddle.net/maniator/ZKBYU/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜