javascript - Backbone pushState routes -
I want to change the hashtag on beautiful urls to deal with backlone.js pushstate. Using the You need to add: and the last 2 strings should be: localhost and the path to my script is
http: //localhost/test/backbone/test.html . But every time the click is thrown at me
localhost / login what am I doing?
var AppRouter = backbone.rotter.ex ({route: {"login": "getPost", "* actions": "defaultRoute"}}); Var app_router = new appraiser; App_router.on ('Route: Receive Post', Function (ID) {Alerts ("Login");}); App_router.on ('route: defaultRoute', function (verb) {alert (verb);}); App_router.navigate ("/ login", {trigger: true}); Backbone.history.start ({PushState: true, root: '/ login /'});
$ (Document)) .delegate ("a", "click", function (evt) {var href = $ (this) .attr ("href"); var protocol = this.protocol + "//"; if (href .slice (Protocol.length)! == Protocol & Protocol! == 'javascript: //' & amp; amp; amp; amp; href.substring (0, 1)! == '#') {evt. PreventDefault (); Backbone History.navigate (href, true);}});
ap_outer. Navigate ("/ login", {trigger: true}); // & lt; - Remove this string backbone.info.start ({PushState: true, root: "test / backbone / test.html"});
Comments
Post a Comment