XMLHttpRequest无法加载http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Affenhausen&destinations=Achenkirch&mode=driving&language=de-DE&sensor=false.请求的资源上不存在"Access-Control-Allow-Origin"标头.因此不允许原点'null'访问.
Javascript代码是
function distanceCalc(){
start_location = $('select.start option:selected').val();
target_location = $('select.end option:selected').val();
$.get('http://maps.googleapis.com/maps/api/distancematrix/xml?origins='+start_location+'&destinations='+target_location+'&mode=driving&language=de-DE&sensor=false', function(data) {
Run Code Online (Sandbox Code Playgroud)
DreamWeaver工作正常,但是当我通过浏览器打开它时,我得到了同样的错误.