Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pushstate is not working correctly in backbone.js

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.

like image 721
iamgopal Avatar asked Aug 27 '11 17:08

iamgopal


1 Answers

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.

like image 103
iamgopal Avatar answered Sep 28 '22 02:09

iamgopal