我有一个像这样的代码:
function doSomething(customer)
{
var xmlhttp = new getXMLObject();
var customer1 = customer;
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtSomething").innerHTML=xmlhttp.responseText;
}
}
var params = "customer=" + customer;
xmlhttp.open("POST","/something.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(params);
post.call(this, customer1);
}
在某些执行中,名为post的第二个函数丢失了变量customer1的值,但它很好地到达了something.php。有什么不对?
谢谢你。