jquery - github.io 阻止了 ajax 请求

标签 jquery ajax github-pages

我所有带有ajax请求的应用程序都返回错误:此请求已被阻止;内容必须通过 HTTPS 提供。 例如: https://zzharuk.github.io/local_weather_widget/

function getWeather(location, value, callback) {
    var url = "http://api.openweathermap.org/data/2.5/weather";
    $.ajax({
        dataType: "jsonp",
        url: url,
        jsonCallback: 'jsonp',
        data: {
            appid:"3556435b983a95646ad9cab4a5ee0943",
            units: value,
            lat:location.latitude,
            lon:location.longitude
        },
        cache: false,
        success: function (data) {
            callback(data);
        }
    });
}
function LocalWeather() {
        $.ajax({
            url: '//freegeoip.net/json/',
            type: 'GET',
            dataType: 'jsonp',
            success: function (location) {
                getWeather(location,"metric",function (data) {
                    console.log(location);
                    console.log(data);
                 })
            }
        })
    }

最佳答案

通过阅读their prices list ,您可以看到 SSL 仅适用于某些付费订阅者。

关于jquery - github.io 阻止了 ajax 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38433099/

相关文章:

php - 自动更新网页内容

reactjs - 如何将 React 应用程序部署到个人页面的 Github 页面

github - 具有编号标题的 Jekyll 帖子出现 "no implicit conversion of Integer into String"错误

jekyll - 更改我的 github 页面的主题,页面为空

javascript - 有条件地应用点击时更改的类

javascript - 如何运行在充满 html 的字符串中定义的 JavaScript?

javascript - 复杂的ajax请求到spring post方法

jquery - 在 JSON 响应中返回 'PartialView' 的问题

javascript - Backbone.js 将其绑定(bind)到 $.each

javascript - 站点内的 UTC