【问题标题】:AngularJS [Ionic] - Google apis XMLHttpRequest cannot loadAngularJS [Ionic] - Google apis XMLHttpRequest 无法加载
【发布时间】:2016-09-06 20:46:40
【问题描述】:

我想从 Google Api 获取 json 数据,但是使用 get 方法和 jsonp 方法这是行不通的。

她是我的密码:

        $http({
    method: 'get',
    url: 'https://maps.googleapis.com/maps/api/place/search/json?location=46.2030350,6.1522080&radius=500&types=restaurant&sensor=false&key=MY_KEY&callback=?'
    }).then(function successCallback(response,data) {
        console.log(data)
    }, function errorCallback(response) {
        console.log('nope')
    });

我有XMLHttpRequest cannot load

【问题讨论】:

    标签: angularjs json google-maps xmlhttprequest


    【解决方案1】:

    这就像你试图通过浏览器直接运行 file 而没有 server。您将需要 xampp 或其他网络服务器。

    或者只需安装python 2.7 并使用以下命令,您的项目文件所在位置为python -m SimpleHTTPServer 8000,然后导航到localhost:8000

    【讨论】:

    • 嗯,我正在使用 Ionic 框架,它适用于 Android-iOS 应用程序
    猜你喜欢
    • 2015-03-16
    • 1970-01-01
    • 2012-05-23
    • 1970-01-01
    • 2011-11-01
    • 1970-01-01
    • 2023-04-10
    相关资源
    最近更新 更多