The answer to your IT questions
 

Advanced search  • Search tips
My QUESTIONS & ANSWERS
 Question:

Why Onreadystatechange method is not called on IE7 ?

User Asked by: james73
Published on: 08:20/13.09.2008
Status: OPEN
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.
 Answers: 1
Sort by: /\ date | rating
Image Answer by: xpert
Posted on: 08:20/14.09.2008
Rating: 4 from possible 5 with 1 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
  
| Home | Hall of fame | Register | Log in | Terms of service | Help | Contacts |