title: Rails: How to use jQuery to redirect to root page in different environments?
body: <p>My rails app is called <code>submission</code>
  I am using  this line in my code to redirect to my app index page:</p>
  
  <pre><code>window.location = "/"
  </code></pre>
  
  <p>it is working since my index page is <code>http://localhost:3000/</code></p>
  
  <p>But after I deploy my app to tomcat, </p>
  
  <p>url changed and the index page become: <code>http://localhost:8080/submission/</code></p>
  
  <p>so the jquery code always redirect me to <code>http://localhost:8080/</code> which is tomcat index page but not the app index page.</p>
  
  <p>What do I need to change in the jquery code in order to redirect to the correct index page?</p>
  
  <p>p.s. I don't want to change the code to <code>window.location = "/submission"</code> because sometimes the app name could change.</p>