2
我有一個腳本運行在xampp上,當我運行此警報調用腳本時,該文件執行,但是當我運行它沒有警報時,它只是坐在那裏,並沒有返回任何東西。我究竟做錯了什麼?Ajax腳本有時只返回結果?
代碼:
var xhr;
function getPlants(xhr){ 嘗試xhr = new XMLHttpRequest(); (微軟){
} } (其他微軟){
} catch(othermicrosoft){ 嘗試xhr = new ActiveXObject(「Microsoft.XMLHTTP」);
} catch(失敗){0} xhr = false; alert(「ajax not supported」); }}
}
xhr.onreadystatechange=state_change;
xhr.open("GET","db_interactions.php",true);
xhr.send(null);
alert("sent");
function state_change() {
if(xhr.readyState==4 && xhr.status==200) {
alert("all systems go");
return xhr.responseText;
}
}
@Daquan - 如果你刪除並替換警報一個接一個,哪一個會停止工作? – 2010-01-21 20:23:06