【问题标题】:ajax jquery json, call google geo api - cant catch the answerajax jquery json,调用google geo api - 无法得到答案
【发布时间】:2013-01-17 13:57:29
【问题描述】:

我想使用 google geo api 如果我将其传递到网址中:

https://maps.googleapis.com/maps/api/geocode/json?address=montreal&sensor=false

我得到了 json 对象,就像 google api doc 说的那样

现在,我想做的是:

在 ajax 中执行,这就是我的代码:

$.ajax(
        {
        url: 'https://maps.googleapis.com/maps/api/geocode/json?address=montreal&sensor=false',
        dataType: 'json',
        success: function (data) {
        //do stuff
                                }
        }
                              )

     };

一切正常, 我只想向用户显示加载动画,直到我取回对象,有时这需要时间..

有什么想法吗? 谢谢!

【问题讨论】:

    标签: jquery .net ajax json asp-classic


    【解决方案1】:

    alert() 语句在success 回调函数中,因此在您收到对象之前肯定不会发出警报。但是,您返回的对象没有d 属性,因此调用alert(data.d) 将输出undefined

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多