By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,814 Members | 2,162 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,814 IT Pros & Developers. It's quick & easy.

call php usingn AJAX responseXML seems to be null

P: n/a
MD
Following snippet is the portion of my program to get the location list in
xml with AJAX
when i alert(request.responseText) it manages to display the xml document
like the following

<? xml version="1.0" ?>
<markers>
<marker lat="32.564" lng="133.212" />
</markers>

However, when calling request.responseXML I have empty document
xmlDoc.documentElement is null
Why is that?

var param = "getShops.php?x1=" + bounds.minX + "&y1=" + bounds.minY + "&x2="
+ bounds.maxX + "&y2=" + bounds.maxY;

var request = GXmlHttp.create();
request.open('GET', param , true); // request XML from PHP with AJAX call
request.onreadystatechange = function () {
if (request.readyState == 4) {
//alert( request.responseText ) <--- this displays wellformed xml
document.
var xmlDoc = request.responseXML;
locations = xmlDoc.documentElement.getElementsByTagName("marke r");
}
}

Aug 30 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
MD
Problem Solved
I just have to specify the text/xml in the header for getshop.php

MD
Aug 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.