I have the following generic Ajax function:
//run post request
function ajaxPost (divid, parameters, file) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function() {
alert ("ok")
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
alert ("ready");
alert (xmlhttp.responseText);
divid.innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST", file,true);
//Send the proper header information along with the request
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", parameters.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(parameters);
}
问题在于本节未按预期运作:
xmlhttp.onreadystatechange=function() {
alert ("ok")
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
alert ("ready");
alert (xmlhttp.responseText);
divid.innerHTML=xmlhttp.responseText;
}
}
在浏览器中,我像我所期望的那样得到“ok”的警示,但是如果说话永远不会发生火灾的话,我的发言就会得到警示。 我认为这是说,营地正在恢复国家更新,但出于某种原因,从来不恢复现成的法典。 如何做到这一点——我没有想法。
谁能告诉我,为什么我会放弃现成的法典?
The php is not the problem:
<?php
echo "new";
?>
I have tested the function input (divid, parameters and file), and these are ok. This function was previously working in a seperate project.