Я использую плагин simpleweather для отображения текущей погоды и работал до вчерашнего дня. Теперь он показывает ошибку как «не может прочитать канал свойства« null ». Когда я отлаживал скрипт, я обнаружил, что данные yahoo не могут получить сообщение о недоступности сервиса, поэтому query.results.channel имеет значение null. Может ли кто-нибудь решить мою проблему? Вот мой код:не может прочитать свойство 'channel' of null with simpleweather.js
<script type="text/javascript" src="/sites/dev/_catalogs/masterpage/NMSTheme/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="/sites/dev/_catalogs/masterpage/NMSTheme/js/jquery.simpleWeather.js"></script>
<script type="text/javascript" src="/sites/dev/_catalogs/masterpage/NMSTheme/js/yqlgeo.js"></script>
<script type="text/javascript">
$(document).ready(function() {
loadWeather();
setInterval(loadWeather, 6000);
});
function loadWeather() {
debugger;
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(function(position) {
var location = (position.coords.latitude + ',' + position.coords.longitude);
var woeid = undefined;
$.simpleWeather({
location: location,
woeid: woeid,
unit: 'f',
success: function (weather) {
var time = ReturnCurrentTime();
placehtml = '<span><h5>' + weather.city + ',' + weather.region + '</h5><span/>';
datehtml = '<span><h5> ' + weather.forecast[0].day + ',' + time + '</h5><span/>';
html = '<span><h5> ' + weather.temp + '°' + ' ' + weather.units.temp + '</h5><span/>' ;
$("#date").html(datehtml);
$("#place").html(placehtml);
$("#weather").html(html);
},
error: function (error) {
$("#weather1").html('<p>' + error + '</p>');
}
});
});
}
}
</script>
Похоже, что они имеют некоторый t https://github.com/monkeecreate/jquery.simpleWeather/issues/101#issuecomment-173530978 – naoxink