My app's index page is at http://cms/admin
(I'm on localhost). On the index page there is only one a
element:
<a href="/admin/test">deneme</a>
When i click on the link it goes to /cms/admin/test
I want to use BackboneJS's routing mechanism to convert my app to ajax friendly app but i can't do it until now. Here is my JS code:
$(function() {
var AppRouter = Backbone.Router.extend({
routes: {
"test": "defaultRoute"
},
defaultRoute: function() {
console.log('its here');
}
});
var appRouter = new AppRouter();
Backbone.history.start({
pushState: true,
slient: true,
root: '/admin/'
});
});
When i run the page and click the link, it doesn't log anything to console and browser follows the link. After page loads, it logs "its here" message.
I already tried it without the root param, "/admin/test" instead of "test". i tried every combination of: "test", "/test", "test/", "/admin/test", "admin/test" etc..
Thanks.