本文介绍了谷歌地图API突然停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况很糟糕...一切正常,突然googlemaps api停止工作

There is wierd situation ... everything was working and suddenly googlemaps api stopped working

$('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控制台中什么也没显示...没有请求发布...有任何想法吗?

I have no idea why this ajax request suddenly stopped working ... in firbug console it shows nothing ... no request posted ... any ideas?

推荐答案

此问题也许缺少CORS HTTP标头解释了为什么它停止工作.

Perhaps this issue missing CORS HTTP Header explains why it stopped working.

Google地理编码Web服务的HTTP标头响应中未包含Access-Control-Allow-Origin:*,因此无法通过javascript跨域访问该服务.直到上周五,该标题才包含在内.

Google Geocoding Web Service is not including Access-Control-Allow-Origin:* in HTTP header responses, so service cannot be cross-domain accesed from javascript.Until last week Friday, that header was included.

如果是问题,请开始该问题.

Start that issue if that is the problem.

这篇关于谷歌地图API突然停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 21:25