How to pass parameters using Backbone.history.navigate?

I just started working with Backbone.js and wondered how I can send parameters using Backbone.history.navigate ? I currently have the following:

 Backbone.history.navigate("classrooms", true) 

This sends the page to page:

 http://localhost:3000/profile#classrooms 

I want the url to look like this:

 http://localhost:3000/profile#classrooms?size=300 

What syntax would I use for this?

Thanks!

+4
source share
1 answer

You can transfer this fragment directly to navigate :

 Backbone.history.navigate("classrooms?size=300", true) 

Everything should work fine if your routes are configured correctly.

Demo: http://jsfiddle.net/ambiguous/f27yv/

+1
source

All Articles