Created
September 24, 2012 20:55
-
-
Save Red-Folder/3778323 to your computer and use it in GitHub Desktop.
Phonegap Service Tutorial - Part1 - Index.html - getTweets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(document).ready(getTweets); | |
function getTweets() { | |
var url = "http://search.twitter.com/search.json?q=phonegap&rpp=3&page1"; | |
$.getJSON(url, function(data) { | |
var tweets = $.map(data.results, function (tweet) { | |
return { | |
author: tweet.from_user, | |
tweet: tweet.text, | |
thumbnail: tweet.profile_image_url, | |
url: 'http://twitter.com/' + tweet.from_user + '/status/' + tweet.id_str | |
}; | |
}); | |
var template = Handlebars.compile($('#tweets-template').html()); | |
var html = template(tweets); | |
$('ul.tweets').append(html); | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment