jquery - Cannot get API to work. Help please! -


hi can't seem weather api work. i'm using jquery , json , below code i've been staring @ day , can't figure out i'm going wrong. please cast eyes on below , tell me what's going on? in advance dave.

$.get('http://www.worldweatheronline.com/feed/weather.ashx?q=auckland,new+zealand&format=json&num_of_days=2&key=7677dba721211420113101', function(data, textstatus)      {     alert('status '+textstatus);     alert('json data string is: '+data);      // give array of objects     var weather = json.parse(data);      // iterate on public_tweets     for(var x=0; x < weather.length; x++) {         var twt = weather[x];          var elm = weather.current_condition.temp_c;         alert('current temp is:'+elm);       }); 

your loop doesn't have terminating bracket:

$.get('http://www.worldweatheronline.com/feed/weather.ashx?q=auckland,new+zealand&format=json&num_of_days=2&key=7677dba721211420113101', function(data, textstatus)      {         alert('status '+textstatus);         alert('json data string is: '+data);          // give array of objects         var weather = json.parse(data);          // iterate on public_tweets         for(var x=0; x < weather.length; x++)          {             var twt = weather[x];              var elm = weather.current_condition.temp_c;             alert('current temp is:'+elm);         }     }); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -