私は次のようなルーター設定をしています:
var AppRouter = Backbone.Router.extend({
routes: {
"/agents/:id": "getAgent",
"/orders/:id": "getOrders",
"/users/:id": "getUsers",
'*path': 'defaultRoute'
},
getAgent: function(id) {
ticketList.url = "/index.php/tickets/viewJSON/a"+id;
},
getOrders: function(id) {
ticketList.url = "/index.php/tickets/viewJSON/o"+id;
},
getUsers: function(id) {
ticketList.url = "/index.php/tickets/viewJSON/u"+id;
},
defaultRoute: function() {
//(here needs to be the code)
}
});
私はcodeigniterを使用しているので、アクセスするときに、/index.php/agents/view/1103
を強制する必要がありticketList.url
ます/index.php/tickets/viewJSON/a1103
-a
はから取得されます/agent/
(これは、、、、、、の間でそれぞれ変更さuser
れ、agent
URLorder
のセクションの末尾にあるIDから取得されます。u
a
o
view
URLからこれらのパラメータを取得するためのデフォルトルートを取得するための最良の方法は何ですか?文字通りdocument.URLを分割しますか?