$('#myClick2').change(function() {
if (this.checked) {
$.getJSON('message_center_getMessageLists.asp', {}, function (json) {
$.each(json.items, function (i, item) {
alert(item.rank.distID);
alert(item.rank.name);
alert(item.rank.description);
});
})
.error(function() {
alert("There was an error while trying to make this request; If it persists please contact support");
});
}
});
我似乎無法得到上述工作,我必須失去一些東西。試圖循環通過Json
下面是JSON的,我通過
{
"rank": [
{
"distID": "1",
"name": "John Doe",
"description": "My Rank"
},
{
"distID": "2",
"name": "Jane Dow",
"description": "My Rank"
},
{
"distID": "3",
"name": "Robin Doe",
"description": "My Rank"
},
{
"distID": "4",
"name": "Ryan Doe",
"description": "My Rank"
}
]
}
會發生什麼或沒有發生。你會得到什麼錯誤。 – 2012-03-09 20:55:59
你有錯誤信息?什麼似乎沒有工作? – talnicolas 2012-03-09 20:56:17
你有沒有得到任何輸出? [Javascript控制檯](http://code.google.com/chrome/devtools/docs/console.html)中是否有任何錯誤消息? – millimoose 2012-03-09 20:56:25