谷歌地图API突然停止工作
问题描述:
还有就是奇怪的情况......一切工作,突然的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控制台它没有显示任何内容......没有请求发布......任何想法
答
也许这个问题missing CORS HTTP Header解释了为什么它停止工作。
谷歌地理编码Web服务不包括Access-Control-Allow-Origin:*在HTTP标头响应中,所以服务不能跨域从javascript中接受。 直到上周星期五,该头才被包括在内。
如果这是问题,请启动该问题。
以前没有办法工作。它违反了跨域策略。尝试将'dataType'参数更改为'jsonp'而不是'json' – 2013-02-14 19:18:41
是的,它工作,本地和联机....顺便说一句,我改变了数据类型jsonp ..它仍然死了... – 2013-02-14 19:25:58