/ Published in: JavaScript
This example grab content from <a href="http://startupquote.com/">StartupQuote.com</a>. The ultra cool and super inspiring tumblr blog.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title>Tumblr test</title> </head> <body> <div id="data"> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script> <script type="text/javascript"> var randomNum = Math.ceil(Math.random()*20); $.getJSON('http://startupquote.com/api/read/json?filter=text&start='+randomNum+'&callback=?', function(data) { $.each(data.posts, function(i, posts){ var photocaption = this["photo-caption"]; $('<p>' + photocaption + '</p>').appendTo('#data'); if ( i == 0 ) return false; }); }); </script> </body> </html>