Note that there are some explanatory texts on larger screens.

plurals
  1. POneed direction regarding jquery and json
    primarykey
    data
    text
    <p>I have this url which is JSON webservice <a href="http://ws.geonames.org/weatherJSON?north=90&amp;south=-9.9&amp;east=-22.4&amp;west=55.2" rel="nofollow noreferrer">http://ws.geonames.org/weatherJSON?north=90&amp;south=-9.9&amp;east=-22.4&amp;west=55.2</a></p> <p>I need to write a jquery function to access the JSON object from the above url. I am not sure how to proceed with this task. Could someone help me out with starting out the jquery code?</p> <p>Thanks</p> <hr> <p>Inorder that the HTML appear I removed the "&lt;" for each tag. What I tried doing below is iterate over the items returned via the JSON object. However, I don't seem to get any result. Could some one point out my error in this regard.</p> <p>body></p> <p>div id="para"></p> <p>/div></p> <p>script></p> <p>$.getJSON('<a href="http://ws.geonames.org/weatherJSON?north=90&amp;south=-9.9&amp;east=-22.4&amp;west=55.2" rel="nofollow noreferrer">http://ws.geonames.org/weatherJSON?north=90&amp;south=-9.9&amp;east=-22.4&amp;west=55.2</a>',function(data) {</p> <pre><code> $.each(data.weatherObservations, function(i,item){ $("&lt;p/&gt;").attr("src", item.temperature).appendTo("#para"); if ( i == 3 ) return false; }); }); </code></pre> <p>/script></p> <p>/body></p> <p>Thank you.</p> <hr> <p>Hi,</p> <p>I now need to access another web service. I typed out the code on the exact same lines as above but I don't get any output. Could some one help in pointing my mistake?</p> <pre><code>jQuery(document).ready(function() { var url = 'http://www.worldweatheronline.com/feed/weather.ashx?q=75080&amp;format=json&amp;num_of_days=5&amp;key=ac9c073a8e025308101307'; jQuery.getJSON(url, function(data) { $.each(data.data.weather, function(i, item){ $("body").append("&lt;p&gt;"+item.date+"&lt;/p&gt;"); if ( i == 3 ) return false; }); }); }); </code></pre> <p>Thanks!</p>
    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.
 

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