$('#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