var request;
function callback() {
if (request.readyState == 4) {
try {
if (request.status != 200) {
alert('error');
} else {
// ok, process...
document.getElementById("myDiv").innerHTML= request.responseText;
alert("got data: "+request.responseText);
}
} catch(e) {
alert('error');
}
}
}
function test_get() {
request = new CrossXHR();
request.onreadystatechange = callback;
request.open('GET', 'http://www.gamerservices.co.uk/jackpot_obs_xml.xml');
request.send();
}
4 replies to this topic
#1
Posted 13 December 2012 - 05:56 AM
Hi I'm trying to output a response which is xml but its only displaying in the alert box and not in the div and I'm not sure what I'm doing wrong any idea's
#2
Posted 13 December 2012 - 06:08 AM
Programs only do what you tell them to do. Your calling the alert method.
http://thorpesystems.com | http://proemframework.org | http://github.com/trq
SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
#3
Posted 13 December 2012 - 06:19 AM
yeah I'm trying to output to div I have set up
document.getElementById("myDiv").innerHTML= request.responseText;
#4
Posted 13 December 2012 - 06:49 AM
Alert the result of
document.getElementById("myDiv") first, to see if you get what you expect. Then alert the .innerHTML property.
Keeping it simple.
#5
Posted 13 December 2012 - 07:02 AM
I just get the hardcoded text
got data:
outputting in my div and not the response
request.responseText
which appears ok in the alert box
got data:
outputting in my div and not the response
request.responseText
which appears ok in the alert box
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












