Redirect Javascript (Jquery) function to homepage
<p>I need to redirect the following JS snippet, to <code>http://localhost/homepage</code> at the end of <code>$('form').submit();</code> How can I do it ?</p>

<pre><code>&lt;script&gt;
  //&lt;![CDATA[
    $(document).ready(function() {
      $('#myModal .btn.btn-primary').click(function() {
        $('#myModal').modal('hide');
        $('form').submit();
      });
    });
  //]]&gt;
&lt;/script&gt;
</code></pre>

<p>the html involved is here :</p>

<pre><code>&lt;div class='modal' id='myModal'&gt;
  &lt;div class='modal-header'&gt;
    &lt;div class='close'&gt;&lt;a href="/"&gt;x&lt;/a&gt;&lt;/div&gt;
    &lt;h3&gt;Add Tags&lt;/h3&gt;

  &lt;/div&gt;
  &lt;div class='modal-body'&gt;
    &lt;form accept-charset="UTF-8" action="/tagging" data-remote="true" method="post"&gt;&lt;div style="margin:0;padding:0;display:inline"&gt;&lt;input name="utf8" type="hidden" value="&amp;#x2713;" /&gt;&lt;input name="authenticity_token" type="hidden" value="7x2CSQ5spL32f1rjCJd5MdwYO6uZ+IwVsLEQ9ZB/Xcc=" /&gt;&lt;/div&gt;
        &lt;input id="tags_string" name="tags_string" type="text" value="zoz" /&gt;
        &lt;input id="id" name="id" type="hidden" value="4f1c95e51d41c80ff20003f0" /&gt;
        &lt;div class='modal-footer'&gt;
          &lt;!-- .btn.btn-primary= submit_tag "Add tag" --&gt;
          &lt;a class='btn btn-primary'&gt;
            &lt;input class='hidden' name='commit' type='submit' value='Add Tag'&gt;

          &lt;/a&gt;
        &lt;/div&gt;
    &lt;/form&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>
