【问题标题】:Is there an equivalent for GDownloadUrl function in Google Maps API v3Google Maps API v3 中是否有等效的 GDownloadUrl 函数
【发布时间】:2012-07-17 09:15:21
【问题描述】:

我在各个地方使用了 Google Maps API 第 2 版函数 GDownloadUrl 来下载 XML/JSON 数据。我正在将大约 3 打地图页面转换为版本 3,但我找不到与此功能等效的功能。是否有或者我应该使用另一个库来处理 AJAX/XHR?

【问题讨论】:

    标签: javascript ajax google-maps google-maps-api-3 xmlhttprequest


    【解决方案1】:

    谷歌地图 API v3 中没有内置函数(如果您想要一些历史记录,则有 several discussions in the v3 group,包括 this one including an answer by Pamela Fox from google (at the time))。 demo gallery 中有一个示例(搜索 xml),我有一个在此 example from Mike WIlliams' v2 tutorial that I translated to v3 中使用的版本。

    【讨论】:

      【解决方案2】:

      API V3 中没有等效功能。我使用的是我根据这个例子写的this separate function:

      https://developer.mozilla.org/En/AJAX:Getting_Started#Step_3_.E2.80.93_A_Simple_Example

      (在所有浏览器中都可以正常工作)

      【讨论】:

        【解决方案3】:

        而不是...

            GDownloadUrl('https://your/url.json', function(data) {
                // ...
            });
        

        ...您可以这样做,假设您已加载 jQuery 并且可以作为 $ 使用:

            $.get('https://your/url.json', function(data) {
                // ...
            });
        

        【讨论】:

          猜你喜欢
          • 2011-09-17
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-12-20
          • 2012-06-09
          • 1970-01-01
          • 2012-06-10
          • 1970-01-01
          相关资源
          最近更新 更多