2016-07-18 4 views
1

Alle meine Apps mit AJAX-Anfragen sind Rückkehr Fehler: Diese Anfrage wurde blockiert; Der Inhalt muss über HTTPS bereitgestellt werden. Zum Beispiel: https://zzharuk.github.io/local_weather_widget/github.io blockiert ajax Anfrage

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); 
       }) 
      } 
     }) 
    } 
+0

Änderung 'http: /' auf 'https: /' – madalinivascu

+0

Ich habe das am Anfang, aber: net :: –

+0

ERR_CONNECTION_REFUSED https://zzharuk.github.io/local_weather_widget/index.html 404 wurde nicht gefunden! –

Antwort

0

Alles, was es Sie fragt, ist das sichere HTTP zu tun (HTTPS) anstelle von einfachen, unverschlüsselte http.

So einfach Ihre URL von

ändern
var url = "http://api.openweathermap.org/data/2.5/weather"; 

zu

var url = "https://api.openweathermap.org/data/2.5/weather"; 
+0

es hat auch nicht funktioniert ... –

+0

Welchen Fehler bekommen Sie jetzt? – ADyson

+0

"GET https://api.openweathermap.org/data/2.5/weather?callback=jQuery224046119877...a95646ad9cab4a5ee0943&units=metric&lat=50.4333&lon=30.5167&_=1468842084713 net :: ERR_CONNECTION_REFUSED" –

1

their prices list Durch das Lesen Sie, dass SSL für einige zahlende Abonnenten sehen nur zur Verfügung steht.