Hi All
I have been looking at ajax for the first time lately, and whilst I thought I got the concept, I can't get this bloody thing to work.
I went through the tutorial at W3 schools
http://www.w3schools.com/php/php_ajax_responsexml.asp
It seemed fairly straight forward, so I modified it slightly for my own purposes. I could not get it to work at all, it did not return any XML at all. After 4 hours of pulling out my hair, I thought I will copy the exact version from W3 schools and replicate the database locally.
It did not work. So then I have looked into everything I could think off, but to no avail.
I am using a WAMP setup on my system. With regards to my modifications, I basically have 4 records in a database table. The PHP script pulls them from a database, and using an onclick event call, fires off the javascript. The rest (the ajax code, and the PHP page that creates the XML) are the exact same as the W3 example.
I have used an alert box after the xmlhttp.open("GET", url, true) part of the code, and it does have the url as I would expect it to be (for instance clicking on link 1 that I pulled from the database on the PHP page gives me responseXML.php?q=1, or link 2 gives repsonseXML.php?q=2 etc......).
It seems like it does not then get read in the $q=$_GET['q'] part of the PHP page (responseXML.php). If I open up responseXML.php and hard code a value to the $q variable it will produce XML data displayed to this page.
I keep thinking maybe the XML document wasn't well enough formed, but surely then it wouldn't have worked with hardcoded variables? I have also read about headers with content type of text/xml, I have tried implementing these from examples shown but again no joy.
When I tried the W3 version with responseText instead of the responseXML version it worked fine. Does anybody out there have any idea's what I am doing wrong?

I hope I have explained this well enough, I am going nuts trying to figure this out.
Many Thanks
Hank Scorpio