日期:2014-05-17  浏览次数:20411 次

Ajax不执行回调函数问题
[code=JScript][/code]
function Check() {
  var num = document.getElementById("txtNum").value;
  httpRequest = ceartHttpRequest();
  var url = "CouponsCheck.aspx?num=" + num;
  httpRequest.open("POST", url, true);
  //httpRequest.onreadystatechange == callback;
  httpRequest.send(null);
  httpRequest.onreadystatechange == function () {
  if (httpRequest.readyState == 4 && httpRequest.status == 200) {
  var response = request.responseText;
  var Msg = document.getElementById("divMsg");
  if (response == "0") {
  Msg.innerHTML = "不存在!";
  } else if (response == "1") {
  Msg.innerHTML = "已使用!";
  } else {
  Msg.innerHTML = response;
  }
  } //
  else
  setTimeout("Check()", 1000);
  }
  }
用firebug调试果断的不执行回调函数。在firebug调试中,readystate=4, status=200 但是就是不进去。不知道为什么。大伙帮忙看看。

------解决方案--------------------
httpRequest.onreadystatechange == function () {
httpRequest.onreadystatechange =function () {