我正在从集合中的 instagram url 读取 json 数据,并在视图中获取集合数据,但没有得到任何响应。怎么了?
模型:
define([
'underscore',
'backbone'
], function(_, Backbone) {var TopListModel = Backbone.Model.extend(return TopListModel;});
收藏:
define([
'jquery',
'underscore',
'backbone',
'models/topList/topListModel'
], function($, _, Backbone, TopListModel){
var TopListCollection = Backbone.Collection.extend({
model: TopListModel,
url: 'https://api.instagram.com/v1/tags/'+hashtag+'/media/recentaccess_token='+access_code,
});
return TopListCollection;
});
看法:
define([
'jquery',
'underscore',
'backbone',
'text!templates/sidebar/topList.html',
'collections/topList/TopListCollection',
//'text!templates/home/homeTemplate.html'
], function($, _, Backbone, topList, TopListCollection){
var TopListView = Backbone.View.extend({
el: $("#sidebar"),
initialize: function(){
_.bindAll(this, 'render');
var topListCollection = new TopListCollection();
topListCollection.fetch({success: function(collection, data){
console.log(data);
}});
//this.render();
},