In IE6, the standard XMLHttpRequest object was not available. You had to use the ActiveX object, instead. This ActiveX object would be outside of the browser DOM and, therefore, I would not expect to be able to attach events to it as you would regular DOM objects. What events are you trying to listen for?
i know it would be easier if i would just attach one listener function to an event and that particular function would do all that i need to do. but i have a better reason why i opted not to.
i was trying to create a library file that would do some common functionality and i would want to return the ajax object cause the caller might want to do something else with it. to do this they would add another event listener to it.
e.i, for example i created a function that would fetch some content from the server. the function would return the ajax object cause another event listener may be added for it to re-enable the button after the request was accepted.
i was trying to create a library file that would do some common functionality and i would want to return the ajax object cause the caller might want to do something else with it. to do this they would add another event listener to it.
Well, funny thing is that I did create a set of library functions for passing back the AJAX object and further manipulating it with other functions. You can create your own addListener method on the AJAX object you create. The user can just pass a pointer to their function when you're ready to attach their listener. The two methods I showed are the methods I used to attach/unattach the pointer to the user's function.
oh yes very nice. you don't know how hard i've tried to find a workaround. but anyway, i think i'm getting your idea. and if i'm right...it's roughly implemented this way:
var _listenerFunctions = new Array;
function addListener(func) {
_listenerFunction.push(func);
}
function listenerFunction() {
for (i in _listenerFunctions) {
_listenerFunctions[i];
}
}
function instantiate_ajax_object() {
// instantiate ajax object of used browser
ajax_object.onreadystatechange = listenerFunction;
Bookmarks