Good Afternoon.
Website: www.barona.com/beat-the-heat/
YQL error: 'Uncaught TypeError: Cannot read property 'channel' of null'
I have made no recent edits. Looks like a problem with yahoo ql or YQL. Getting the same error on other test sites and see people are posting the same thing. Anyone know a simple hotfix? please be as detailed with the steps as possible. Thanks in advance! :)
http://www.onextrapixel.com/2011/08/22/adding-weather-to-your-site-with-jquery-and-yql/ You can see that their demo isn't working: http://www.onextrapixel.com/examples/jquery-yql-weather/
HTML:
<img src="/wp-content/uploads/2015/09/featured-BTH-promo.jpg" width="1110" height="360" class="alignnone size-full wp-image-4222" style="width: 100%; max-width: 100% display: block;" />
When it’s 95 degrees out at Barona, get inside and Beat the Heat at Barona where our Loose Troop will give away 3x points on slots, keno, and video poker! Once it hits 95 degrees, you’ll earn 3x points till Midnight! Barona Casino is ALWAYS the COOLEST place to be!
Be sure to add Lakeside, CA to your Yahoo! weather app on your iPhone or Android phone to see current weather conditions in Lakeside, CA.
</br>
<div class="eventBlurb">
<div id="wxWrap">
<span id="wxIntro">Current temperature at Lakeside, CA:</span><span id="wxIcon2"></span><span id="wxTemp"></span>
</div>
</div>
</br>
<small>Multiplied points are applicable toward cash back, and are not applicable toward comps or greater Club Barona tier status.</small>
</br>
<p style="text-align: left;"><a class="btn aply_player" href="/wp-content/uploads/15SE271_GenericPointMultiplier_RulesSheet.pdf" target="_blank">View promotion rules</a></p>
JS:
$(function(){
var loc = '92040';
var u = 'f';
var query = "SELECT item.condition FROM weather.forecast WHERE location='" + loc + "' AND u='" + u + "'";
var cacheBuster = Math.floor((new Date().getTime()) / 1200 / 1000);
var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + '&format=json&_nocache=' + cacheBuster;
window['wxCallback'] = function(data) {
var info = data.query.results.channel.item.condition;
$('#wxIcon').css({
backgroundPosition: '-' + (61 * info.code) + 'px 0'
}).attr({
title: info.text
});
$('#wxIcon2').append('<img src="http://l.yimg.com/a/i/us/we/52/' + info.code + '.gif" width="34" height="34" title="' + info.text + '" />');
$('#wxTemp').html(info.temp + '°' + (u.toUpperCase()));
};
$.ajax({
url: url,
dataType: 'jsonp',
cache: true,
jsonpCallback: 'wxCallback'
});
});
I wanted to say that the reason this didn't work was because the YQL API was broken and that was something they had to add on their end. It was also roughly 10 degrees off and outdated temperature. We ended up using something more accurate.