Note that there are some explanatory texts on larger screens.

plurals
  1. POUncaught ReferenceError: url is not defined
    text
    copied!<p>I keep getting this error at referring to <code>'url'</code> in this block of code. </p> <blockquote> <p>Uncaught ReferenceError: url is not defined. </p> </blockquote> <p>Although the URL is defined clearly in a variable above the ajax. What am I doing wrong? </p> <pre><code>$.ajax({ url: url, dataType: 'jsonp', cache: true, jsonpCallback: 'wCallback_1' }); </code></pre> <p>Here is the full code</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" language="javascript"&gt; $(function () { // Specify the location code and units (f or c) var location = 'SPXX0550'; var u = 'c'; // Run the query (pull data from rss feed) var query = 'SELECT * FROM rss WHERE url="http://xml.weather.yahoo.com/forecastrss/' + location + '_' + u + '.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['wCallback_1'] = function(data) { var info = data.query.results.item.forecast[0]; $('#wIcon').append('&lt;img src="http://l.yimg.com/a/i/us/we/52/' + info.code + '.gif" width="34" height="34" title="' + info.text + '" /&gt;'); $('#wTemp').html(info.temp + '&amp;deg;' + (u.toUpperCase())); $('#wText').html(info.text); }; $.ajax({ url: url, dataType: 'jsonp', cache: true, jsonpCallback: 'wCallback_1' }); </code></pre> <p></p>
 

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