Menampilkan RSS Feed menggunakan YQL Yahoo


Mencoba menampilkan data cuaca dari github :

$(document).ready(function() {
  $.ajax({
    jsonp: "callback",
  
    // tell jQuery we're expecting JSONP
    dataType: "jsonp",
  
    // tell YQL what we want and that we want JSON
    data: {
         + "select * from t_weather where location='ottawa,canada' and unit='c'",
        format: "json"
    },
    success: function( response ) {
      var channel = response.query.results.weather.rss.channel;
      $('#weather').append($('<h2/>').text(channel.description));
      $.each(channel, function(index, item){
        if (item.description) { $('#weather').append($('<p/>').html(item.description)); }
      });
    }
  });
});

Smoga berguna.....! :
Previous
Next Post »