pushstate is not working correctly in backbone.js
If I am using Backbone with pushsta开发者_运维知识库te, how should I format my links?
Currently I am doing this:
<a href="task/create">create task</a>
If I use the above format, it actually sends a GET
request to the server, which serves a standard page and backbone correctly identifies that it should go to task/create
, which it does, and shows the view.
But why is it sending a GET
request in the first place? (even though I have set pushstate to true?)
edit: I am using the latest version of Chrome (as of August 2011), so my browser is not a problem, I think.
ok got it answered from here. https://github.com/documentcloud/backbone/issues/456
clicking links are not suppose to be pushstate friendly. one may try to live bind it via jquery and use custom function to create that effect.
In case any other readers would like more information on routing, there's a whole chapter dedicated to explaining routing available in pages 32-46 here: http://samples.leanpub.com/marionette-gentle-introduction-sample.pdf (full disclosure: I'm the book author)
精彩评论