I'm playing around with Backbone these last days..
I want to receive some data from the twitter search API. But I don't really understand how it works. This is my code:
(function($){
Tweet = Backbone.Model.extend();
Tweets = Backbone.Collection.extend(
{
model: Tweet,
url: 'http://search.twitter.com/search.json?q=Hamburg&rpp=5&lang=all&callback=?',
parse: function(response)
{
return response.results;
}
});
DefaultTweetView = Backbone.View.extend(
{
initialize: function(){
_.bindAll(this, 'render');
}
template: _.template('<p>@<%= from_user %> <em></em></p><p><%= text %></p><p><%= location %></p>'),
render: function()
{
$(this.el).html(this.template(this.model.toJSON()));
return this;
}
});
app = new Tweet();
})(jQuery);
I don't think this could be right. But I don't know how to handle it :( Could someone help me or post a link where I could follow some instructions about json data and backbone please?