In the same document, I sometimes want to perform an asynchronous Ajax call and other times I want to perform a synchronous call. For the asynchronous call, of course, I associate a handler with the [b]onreadystatechange[/b] event. For the synchronous call, I don’t want a handler associated with that event — but I can’t seem to find a method for clearing (resetting) the association once it has been made. If I try to set it to [b]null[/b], I get a type mismatch error. I also tried using the [B]delete[/B] operator, but (though no error) that didn’t remove the association. Solution?
@phpnoviceauthorMay 11.2006 — #You mean make a new one each time I need it? ...or, make one for synchronous and one for asynchronous operations? In either case, it seems non-sensical to have to go to that extent. Instead of workaround, isn't there a solution?
@phpnoviceauthorMay 12.2006 — #OK, came up with a better workaround for my solution: if (opt) xmlhttp.onreadystatechange = func; // assign function for response else xmlhttp.onreadystatechange = function(){return true};