I am trying to organize a request/response ajax thingy here and have written this.
function myAJAXRequest (url, sendOutputTo)
{
this.url = url;
this.myRequest = new XMLHttpRequest ();
this.sendOutputTo = sendOutputTo;
this.myResponseDoc = null;
function processReqChange ()
{
var state = myRequest.readyState;
alert ("STATE (" + state + ")");
if (state == 4)
{
myResponseDoc = myRequest.responseXML.documentElement;
if (sendOutputTo != null)
{
sendOutputTo (myResponseDoc);
}
}
}
this.myRequest.onreadystatechange = this.processReqChange;
this.myRequest.open("GET", this.url, true);
this.myRequest.send("");
}
My method processReqChange never gets executed, much less can I track the state changes. I have been able to get this to work outside of the OO style. I am a little weak on Javascript OO and am trying to not have a custom processReqChange script for each of my requests.
Thanx
Bodger
function myAJAXRequest (url, sendOutputTo)
{
this.url = url;
this.myRequest = new XMLHttpRequest ();
this.sendOutputTo = sendOutputTo;
this.myResponseDoc = null;
function processReqChange ()
{
var state = myRequest.readyState;
alert ("STATE (" + state + ")");
if (state == 4)
{
myResponseDoc = myRequest.responseXML.documentElement;
if (sendOutputTo != null)
{
sendOutputTo (myResponseDoc);
}
}
}
this.myRequest.onreadystatechange = this.processReqChange;
this.myRequest.open("GET", this.url, true);
this.myRequest.send("");
}
My method processReqChange never gets executed, much less can I track the state changes. I have been able to get this to work outside of the OO style. I am a little weak on Javascript OO and am trying to not have a custom processReqChange script for each of my requests.
Thanx
Bodger