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