in Advanced 

Question preview

HomeQuestion preview:
Log in

Why Onreadystatechange method is not called on IE7 ?

I am filling a list dynamically from server with Ajax. I am having the following problem. Method onreadystatechage on server request is not called in IE7 (Internet explorer 7) the second time I invoke the method.

..........
 if(request && request.readyState < 4)
   request.abort();
  if(!window.XMLHttpRequest)
  request = new ActiveXObject("Microsoft.XMLHTTP");
  preFunc();
  request.onreadystatechange = processRequestChange;
  request.open("POST", uriFunc(), true);
  request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  request.setRequestHeader("Accept-Charset", "utf-8");
  request.send(constructPostParamsFunc());
.............
 if(request && request.readyState < 4)
   request.abort();
  if(!window.XMLHttpRequest)
  request = new ActiveXObject("Microsoft.XMLHTTP");
  preFunc();

  //THIS IS NOT INVOKED!!!!!!
  request.onreadystatechange = processRequestChange;

  request.open("POST", uriFunc(), true);
  request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  request.setRequestHeader("Accept-Charset", "utf-8");
  request.send(constructPostParamsFunc());



The code works in IE6, FFox, Opera, Safari.
Do you know someone who could answer? Ask him for help
Answers: 1
Sort by: date rating
image xpert
11:20/14.09.2008
3.2 from possible 5 with 5 votes
Open method resets all properties of Request object on IE7.
Calling the open method initializes the request object. If you have set properties (such as onreadystatechange) it is reset to initial default values (NULL). So, do all your initialization between OPEN and the final call to SEND.
Vote:
Please vote! Your opinion matters!
If you haven't found what you've looking for, post a question
Ask question
| Home | Hall of fame | Registration | Log in | Terms of service | Privacy policy | Help | Contacts | RSS |