Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling multiple functions in Javascript
    primarykey
    data
    text
    <p>I am trying to call multiple functions using Yahoo's YQL. What I am trying to display is the weather for each day. The XML file has [0] for todays [1] tomorrow [2] the day after etc. When I run the code it looks at the last number called and does not load the others. Where I am I going wrong?</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; // javascript will go here $(function(weatherone){ var query = "select * from rss where url='http://xml.weather.yahoo.com/forecastrss/SPXX0050_f.xml'"; var cacheBuster = Math.floor((new Date().getTime()) / 1200 / 1000); var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + '&amp;format=json&amp;_nocache=' + cacheBuster; window['wxCallback'] = function(data) { var info = data.query.results.item.forecast[0]; $('#wxDay').text(info.day); $('#wxIcon').css({ backgroundPosition: '-' + (61 * info.code) + 'px 0' }).attr({ title: info.text }); $('#wxIcon2').append('&lt;img src="http://l.yimg.com/a/i/us/we/52/' + info.code + '.gif" width="74" height="74" title="' + info.text + '" /&gt;'); $('#wxTemp').html(info.high + '&amp;deg;' + (u.toUpperCase())); $('#wxText').html(info.text); }; $.ajax({ url: url, dataType: 'jsonp', cache: true, jsonpCallback: 'wxCallback' }); }); $(function(weathertwo){ var query = "select * from rss where url='http://xml.weather.yahoo.com/forecastrss/SPXX0239_f.xml'"; var cacheBuster = Math.floor((new Date().getTime()) / 1200 / 1000); var url = 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(query) + '&amp;format=json&amp;_nocache=' + cacheBuster; window['wxCallback'] = function(data) { var info = data.query.results.item.forecast[1]; $('#wxDay').text(info.day); $('#wxIcon').css({ backgroundPosition: '-' + (61 * info.code) + 'px 0' }).attr({ title: info.text }); $('#wxIcon2').append('&lt;img src="http://l.yimg.com/a/i/us/we/52/' + info.code + '.gif" width="74" height="74" title="' + info.text + '" /&gt;'); $('#wxTemp').html(info.high + '&amp;deg;' + (u.toUpperCase())); $('#wxText').html(info.text); }; $.ajax({ url: url, dataType: 'jsonp', cache: true, jsonpCallback: 'wxCallback' }); }); &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload