私は次のようなルーター設定をしています:
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れ、agentURLorderのセクションの末尾にあるIDから取得されます。uaoview
URLからこれらのパラメータを取得するためのデフォルトルートを取得するための最良の方法は何ですか?文字通りdocument.URLを分割しますか?