jQuery and Yahoo pipes simple ajax call


/ Published in: jQuery
Save to your folder(s)

Very simple example of pulling in a JSON feed from Yahoo pipes using jQuery.


Copy this code and paste it in your HTML
  1. jQuery(function($){
  2. //The yahoo pipe url (callback can be in the url, just pointing it out)
  3. var pipeURL = "http://pipes.yahoo.com/pipes/pipe.run?_id=00000000000000000000000&_render=json" + "&_callback=?";
  4.  
  5. var feedSuccess = function(date, status){
  6. //Do something with it
  7. var html = "<ul>";
  8. $.each(data.value.items, function(i,item){
  9. html += "<li>" + item.title + "</li>";
  10. });
  11. html += "</ul>";
  12.  
  13. //Add the feed to the page
  14. $("#insertFeed").empty().append(html);
  15. };
  16.  
  17. /**
  18. * Make the ajax call. You can also use $.getJSON.
  19. */
  20. $.ajax({
  21. dataType: "json",
  22. url: pipeURL,
  23. success: feedSuccess,
  24. timeout: 4000
  25. });
  26. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.