みなさん、おはよう、
文字列を反復処理して でデータを解析し、$.parseJSON
それを select に送信しようとしていますが、何らかの理由で、開始時にfor
何も起こらず、エラーなども発生しません..単純に、スクリプトが動作を停止します (終了、php)
json:
{
"response": {
"chars": {
"0": {
"guid": "728166",
"name": "Pepito",
"race": "1",
"class": "6",
"gender": "0",
"level": "80",
"money": "1412915382",
"apoints": "0",
"hpoints": "200000",
"tkills": "1731",
"title": "0"
},
"1": {
"guid": "778879",
"name": "Chocolate",
"race": "7",
"class": "8",
"gender": "1",
"level": "88",
"money": "0",
"apoints": "0",
"hpoints": "0",
"tkills": "0",
"title": "0"
}
}
}
}
コード:
var json = *this is the top json*;
var parsed = $.parseJSON(json);
for (var i=0; i<parsed.length; i++){
console.log(parsed.response.chars[i].name);
}
どの部分が間違っていますか?私の知る限り、私には何の過失もありません。
ありがとう!