Question

I've an ajax based webpage. The xmlHttp object is created as a global variable and used by every functions of my application simply linking the ajax.js script in the page.

var objXmlHttp = createXmlHttpRequestObject();

I've a page with a 3 links menu. By clicking on every link an xmlhttp request print on the page the content of selected menu (i.e. login form or recover password form). The page doesn't reload during this request, so in every call I've a line like this

objXmlHttp.onreadystatechange=function1;

or

objXmlHttp.onreadystatechange=function2;

For strange reason when I send some particular calls I found the old function still bindint to event (I've do an alert to understand). So when the command objXmlHttp.send() starts browser will execute function1 before second statement.

Firefox, Opera and Chrome have this feature, but IE no (this thing make me think I've do something wrong in the code!).

Had anyone ever seen this problem?

I try to work this with this code

objXmlHttp.onreadystatechange=null;

But I never seen it in the tutorial, and IE send me an error of type mismatch.

Thank you for suggest or ideas for my problem!

ps: I'm looking for a solution that don't use any framework because I'd like to learn how make this script by miself!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top