幫助將不勝感激。jQuery Ajax vs經典ASP返回數據
在我的ASP頁面我將返回此[{'id': '123'}]
。如果你查看源代碼,那麼這就是你在頁面上看到的所有內容。所以有道理的是,當我做一個讓我能夠得到的ID。
我的代碼(這是我知道的作品,因爲我用它做對包含相同的數據平面文件一個得到所有我想現在要做的是動態創建的數據):
$.ajax({
type: "GET",
url: "http://localhost/GetCustNewID.asp?callback=?",
async: false,
dataType: "jsonp",
success: function(data){
$(data).each(function(){
alert(this.id)
});
},
error:function(x, e){
if (x.status === 0){
alert("You are offline.");
}
else if(x.status === 404){
alert("404 file not found error");
}
else if(x.status === 500){
alert("500 internal server error");
}
else if(e === 'parsererror'){
alert("200 but can't parse json response");
}
else if(e === 'timeout'){
alert("Request timed out.");
}
else {
alert("Unknown AJAX error");
}
}
});
我得到一個"200 but can't parse json response"
返回。有什麼我失蹤?
謝謝。
它將是跨域的。只是改變它得到了同樣的錯誤 – Barry