1

所以我像这样使用backbone.js:

window.TicketCollection = Backbone.Collection.extend({
    model:Tickets,
    url:"/index.php/tickets/viewJSON"
});

根据我想像这样传递子文件夹的页面:

ticketList.fetch({ data: "a1103" });

然后将附加到url以下内容并从中获取数据:

/index.php/tickets/viewJSON/a1103

这怎么可能?

4

1 回答 1

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();
于 2012-08-01T14:05:46.473 回答