jQuery의 $.each()
을 사용하려고했지만 IE6에서는 작동하지 않았습니다. 그래서 json2를 입력하십시오. 그래서 데이터를 받고 그냥JSON은 ajax에서 stringify를 호출합니다. ie 6과 호환됩니다.
"속성 '축구'정의의 읽을 수 없습니다"말하는하지만 배열
var i;
for(i=0; i<theData.Event.Football.length; i++)
{
alert(theData.Event.Football[i].time);
}
을 통해 호출 다음
var theData = JSON.stringify(data);
를 사용하여 VAR에 결합하고 JSON은 변형을 시도한 지 6 시간 만에 단순한 오해를 사용합니다.
var theData = JSON.stringify(data);
이 소요 :
{
"Event":{
"Football":[
{
"title": "Some Event",
"time": "6:00" ,
"competitors": {
"competitors1": "Boaty Mc Boat",
"competitors2": "Disco Dave"
},
"win": {
"win1": 1.3,
"win2": 1.89,
"win3": 1.79
}
}, {
"title": "Some Event",
"time": "7:00" ,
"competitors": {
"competitors1": "Flesh Wound",
"competitors2": "None Shall Pass"
},
"win": {
"win1": 2.03,
"win2": 1.79,
"win3": 1.79
}
]
}
}
최종 수정이는 AJAX 구문에 문제가 있었다, 여기에 위의 코드는이 줄
$.ajax({
type: 'GET',
url: "football1.json",
dataType: "json",
processData: true,
contentType: "text/json; charset=utf-8",
data: {},
success: function(data){
alert('working');
// do stuff
},
error: function(jqXHR, textStatus, errorThrown) {
console.debug(textStatus, errorThrown);
}
});
* "Jquery의 $ .each()를 사용하고 싶습니다. 작동하지만 6에 없습니다."그래서 json2를 입력하십시오. "* 음 ... 그들은 서로 관련이 없습니다. –