所以我使用backbone.js就像这样:
window.TicketCollection = Backbone.Collection.extend({
model:Tickets,
url:"/index.php/tickets/viewJSON"
});
根据我希望传递子文件夹的页面,如下所示:
ticketList.fetch({ data: "a1103" });
然后将附加到url
并从以下内容中获取数据:
/index.php/tickets/viewJSON/a1103
这怎么可能?
答案 0 :(得分:1)
window.TicketCollection = Backbone.Collection.extend({
subFolder : 'defaultFolder',
url:function(){
return "/index.php/tickets/viewJSON/" + this.subFolder;
}
});
var some = new window.TicketCollection();
some.subFolder = 'a1103';
some.fetch();