title: Routing to a page from JavaScript side
body: <p>Currently I do something like this:</p>
  
  <pre><code>+    var go_to = "http://localhost:3000" + url; 
  +    window.open(go_to);
  </code></pre>
  
  <p>Which takes it to the Index action of a Rail controller and eventually shows the page.</p>
  
  <p>Two things I want to improve:
  1- Definitely hard coding <code>"http://localhost:3000"</code> is dead wrong. But what is the right way?</p>
  
  <p>2- Is there a better way of talking to Rails from JS side to open a new window? </p>