ellitigg Posted November 6, 2006 Share Posted November 6, 2006 Hi, I hope someone can help. I've had a look through the other threads and I can't see anything on this...I've been playing with AJAX and successfully got my code working on one server but now I've migrated it to another server (all paths have been updated!) and the same code doesn't work.The basics are...The Javascript:[code] ...xmlhttp.open('POST', '../tools/displayCalEvents.php', true); /* The callback function */ xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200) { if(xmlhttp.responseXML) { [color=red]alert (xmlhttp.responseXML.getElementsByTagName('title')[0].firstChild.data);[/color] displayPopup(xmlhttp.responseXML); } else if(xmlhttp.responseXml) { alert(xmlhttp.responseXml.getElementsByTagName('title')[0].firstChild.data); displayPopup(xmlhttp.responseXml); } } } }...[/code]The PHP:[code]<?header('Content-Type: text/xml');$res = '<?xml version="1.0" encoding="utf-8"?><xmlresponse><title>Test Meeting</title></xmlresponse>';echo ($res);?>[/code]The alerts are just in there for debugging. The readyState is correctly getting to '4' and the status to '200' but I am getting a Javascript error against the line marked in red saying that an object is required. It seems like the responseXML object is not being returned from the PHP file.Can anyone help? I really appreciate any responses!Many thanks,Elli Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.