我的问题很简单,我有一个名为 new.json 的文件,我正在尝试使用 JQuery 来加载和显示数据。我一直在编写 JavaScript 代码:
$.getJSON("new.json", function(data){
// I have placed alert here previously and realized it doesn't go into here
$.each(data.streetCity, function(i,s){
alert(s);
});
});
}
new.json 中的数据如下所示:
{"streetCity":
{
"1":"Abergement-Clemenciat",
"2":"Abergement-de-Varey",
"3":"Amareins"
}
};