Ajax Get XML - Google Directions

自古美人都是妖i 提交于 2019-12-25 18:14:24

问题


I had the following script working two weeks ago in XAMPP, today it doesnt work.

var url = 'http://maps.googleapis.com/maps/api/directions/xml?origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK&sensor=false';

$.ajax({

type: "GET",
url: url,
dataType: "xml",
async: false,
success: function(xml) {

$(xml).find("route").each(function(){

var startaddresss = $(this).find('start_address').text();

    alert(startaddresss);
});
}
});

If i save the XML to XAMPP and call it from AJAX it works fine. What changed in the last two weeks?

Thanks


回答1:


Cant fix the issue. So i will use PHP to fetch the file and return JSON.



来源:https://stackoverflow.com/questions/19866686/ajax-get-xml-google-directions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!