$('#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"
}
]
}
何が起きるか起こらないかどうかです。あなたはどんなエラーを受けますか? –
エラーメッセージがありますか?何が動作していないようですか? – talnicolas
出力がありますか? [Javascriptコンソール](http://code.google.com/chrome/devtools/docs/console.html)にエラーメッセージがありますか? – millimoose