Palko17
12-10-2007, 11:25 PM
Okay so I have this ajax code below, and it doesn't work... It doesn't even get into the onreadystatechange function, can anyone tell me what i've done wrong. Thank-you so much I've been working on this for 2 days!
var response = false;
function AJAXGet (url, target) {
httpRequest = new XMLHttpRequest();
httpRequest.open ('GET', url, true);
httpRequest.onReadyStateChange = function () {
if (httpRequest.stateChange==4) {
if (httpRequest.status==200) {
if (target=='self') {
response = httpRequest.responseText;
}
}
}
};
return response;
httpRequest.send(null);
}
var response = false;
function AJAXGet (url, target) {
httpRequest = new XMLHttpRequest();
httpRequest.open ('GET', url, true);
httpRequest.onReadyStateChange = function () {
if (httpRequest.stateChange==4) {
if (httpRequest.status==200) {
if (target=='self') {
response = httpRequest.responseText;
}
}
}
};
return response;
httpRequest.send(null);
}