title: How can I pass query string to backbone.js routing
body: <p>I'm using Backbone.js and jQuery-mobile. jQuery-mobile routing is disabled and I'm using the lib only for UI. I got everything working, except selecting page transition. I need to pass the page transition ('slice-up', 'fade', 'slide-down') to the Backbone router because the transition is varying based on where the user comes from.</p>
  
  <p>I have figured a very ugly way to do it, to pass them via the url:</p>
  
  <pre><code>class App.Routers.Foods extends Backbone.Router
    routes:
      '': 'index'
      ':transition': 'index'
      'foods/new': 'new'
      'foods/new/:transition': 'new'
  
    initialize: -&gt;
      @collection = new App.Collections.Foods()
      @collection.fetch()
  
    index: (transition)-&gt;
      view = new App.Views.FoodIndex(collection: @collection)
      App.changePage(view, transition)
  
    new: (transition)-&gt;
      view = new App.Views.FoodNew(collection: @collection)
      App.changePage(view, transition)
  </code></pre>
  
  <p>Here is the html link for default transition:</p>
  
  <pre><code>&lt;a href="#" data-icon="back" class="ui-btn-left"&gt;Back&lt;/a&gt;
  </code></pre>
  
  <p>Here is the html link for fade transition:</p>
  
  <pre><code>&lt;a href="#fade" data-icon="back" class="ui-btn-left"&gt;Back&lt;/a&gt;
  </code></pre>
  
  <p>Using the query string, i.e. /food/new?transition='fade' is definitely better but I don't know how to define the backbone routing to use query string variables.</p>
  
  <p>How should I do this?</p>
  
  <p>Is there a more elegant way to handle my problem, i.e. passing the variable not using the url at all?</p>