2013-02-14 83 views
0

還有就是奇怪的情況......一切工作,突然的GoogleMaps API不輟谷歌地圖API突然停止工作

$('input#find_location_button').on('click', function() { 

.... some script to get value of input field and store it in data_to_send.... 
data_to_send['sensor'] = 'false'; 

    // alert(JSON.stringify(data_to_send)); this alert shows everything is fine 

     $.ajax({ 
      url: 'http://maps.googleapis.com/maps/api/geocode/json', 
      dataType: 'json', 
      data: data_to_send, 
      type: 'GET', 
      success: function (data) 
      { alert(data); // nothing ... 
.... proper closing tags ... 

我不知道爲什麼這個Ajax請求突然停止工作......在firbug控制檯它沒有顯示任何內容......沒有請求發佈......任何想法

+1

以前沒有辦法工作。它違反了跨域策略。嘗試將'dataType'參數更改爲'jsonp'而不是'json' – 2013-02-14 19:18:41

+0

是的,它工作,本地和聯機....順便說一句,我改變了數據類型jsonp ..它仍然死了... – 2013-02-14 19:25:58

回答

1

也許這個問題missing CORS HTTP Header解釋了爲什麼它停止工作。

谷歌地理編碼Web服務不包括Access-Control-Allow-Origin:*在HTTP標頭響應中,所以服務不能跨域從javascript中接受。 直到上週星期五,該頭才被包括在內。

如果這是問題,請啓動該問題。