无法从xml文件javascript读取保存的位置


not able to read saved locations from an xml file javascript

我正试图使用JavaScript从xml文件中读取数据库中保存的位置。我的想法是从保存的位置向该地图添加标记。这是xml代码,我读取xml的方法有问题吗?:

<?php 
$conn=mysqli_connect("localhost", "thecode007", "007","offers") or die(mysql_error());
$query = "SELECT BLocation FROM Branches";
$result = mysqli_query($conn,$query) or die(mysql_error());
 $doc = new DomDocument('1.0');
$node = $doc->createElement("markers");
$parnode = $doc->appendChild($node);
header("Content-type: text/xml");
while($row = mysqli_fetch_array($result))
{
$node = $doc->createElement("marker");
$newnode = $parnode->appendChild($node);
$loc=explode(",",$row[0]);
$newnode->setAttribute("lat", $loc[0]);
$newnode->setAttribute("lon",$loc[1]);
}
 
print $doc->saveXML();
?>
//this code is working

另一个不起作用的代码出现在地图上,但xml文件中的位置没有出现:

 <!--the code up is the map code which is displayed well the problem is downhere-->
   	var marker = new google.maps.Marker({position:latlon1,map:map,title:" here!"});
	var request = new XMLHttpRequest();
request.open("GET", "http://localhost/xml.php", false);
request.send();
var xml = request.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
 var lan2=markers[i].getAttribute("lat");
 var lon2=markers[i].getAttribute("lon");
 var latlon2= new google.maps.LatLng(lan2,lon2);
 marker = new google.maps.Marker({position:latlon2,map:map,title:" here!"});
}
<!--the rest is working-->

对不起,这里错了,我应该打电话:request.open("GET","xml.php",false);不请求.open("GET","http://localhost/xml.php",false);这里的错误是说明文件在服务器中的位置,而不是它在计算机上的位置。。。