call php usingn AJAX responseXML seems to be null

M

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("marker");
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top