8

If I am using Backbone with pushstate, 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.

4

2 回答 2

4

好的,从这里得到答案。https://github.com/documentcloud/backbone/issues/456

点击链接不应该是 pushstate 友好的。可以尝试通过 jquery 对其进行实时绑定并使用自定义函数来创建该效果。

于 2011-08-27T17:36:13.997 回答
0

如果任何其他读者想了解更多关于路由的信息,这里的第 32-46 页有一整章专门用于解释路由:http://samples.leanpub.com/marionette-gentle-introduction-sample.pdf 完全公开: 我是书作者)

于 2013-05-20T17:55:45.560 回答