I just started looking at Backbone.js. Now i wan’t to create a simple search similar to google where the url updates “on the go”. So if you submit a form i want the url to update to http://www.site.com/#/search/I-searched-for-something.
I appreciate every answer 🙂
If I understand the question, you want an arbitrary URL that includes your search term as part of the URL. And I suspect that your problem is you don’t see how to do that with the
routesarchitecture.Routes are nothing but regular expressions:
After that, you would apply a
clickhandler to the button on the search form (or maybe akeypress==13manager to the search field itself) that, instead of actually doing anything, just setswindow.location.hash = escapeURIComponent($('#search_field').val())It’s roundabout, but it gets the job done. Your URLs will be ugly with all the %XX’s in them, but they’ll all be bookmarkable, which is the only reason to do something like this.