Skip to content

Instantly share code, notes, and snippets.

@Red-Folder
Created September 24, 2012 20:55
Show Gist options
  • Save Red-Folder/3778323 to your computer and use it in GitHub Desktop.
Save Red-Folder/3778323 to your computer and use it in GitHub Desktop.
Phonegap Service Tutorial - Part1 - Index.html - getTweets
<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