How to submit a form when it's action= is created outside it
<p>I have this form that's a simple topsearch bar like below. There's no submit button. It get submitted when a user hits enter.</p>

<pre><code>&lt;form style="display:inline;" method="GET" action="/printers/" class="searchForm"&gt;
&lt;input placeholder="Hit enter to search..." type="text" class="topsearchbar" value=""&gt;
&lt;/form&gt;
</code></pre>

<p>Then comes the jQuery. This is where I take the value from the search box and add it to the current action and need to submit it. But I just cannot figure how to do this. Can you please help?</p>

<p>Here's my jquery:</p>

<pre><code>$(".searchForm").submit(function(event) {
event.preventDefault();

var action = ($(".searchForm").attr("action"));
var searchStr = ($(".topsearchbar").attr("value"));


if((action &amp;&amp; searchStr) != '' &amp;&amp;  (action &amp;&amp; searchStr).length &gt;= 5)
{
alert('Ok to proceed')

var serverStr = action+'/'+searchStr;
alert(serverStr)
//Submit the form to serverStr. serverStr is the form's action

}
else
{
alert('To small to be any good')
}

}),
</code></pre>
