Jquery window.location not redirecting but refreshing page
<p>I have the following Jquery snippet </p>

<pre><code>// General search
$j(".search").each(function () {
    var baseURL = "/search.aspx?c=Entire%20Site&amp;q=";
    var searchBox = $j(this);
    searchBox.find("input").keypress(function (e) {
        if (e.keyCode == 13) {
            submitSearchValueFromTextBox(searchBox, baseURL);
        }
    });
});



submitSearchValueFromTextBox = function(searchBox, baseURL) {
        window.location.href = baseURL + escape(searchBox.find("input").val());
    };
</code></pre>

<p>HTML for input</p>

<pre><code>&lt;span class="searchBox"&gt;
              &lt;span&gt;
                &lt;input type="text" name="searchBoxHeader" id="searchBoxHeader" value="&lt;%= SearchLabel %&gt;" /&gt;
              &lt;/span&gt;
            &lt;/span&gt;
            &lt;span class="searchBtn"&gt;
              &lt;a href="#" class="btnSearchTop"&gt;
                &lt;img src="/images/search_btn.gif" name="submitHeader" id="submitHeader"/&gt;
              &lt;/a&gt;
            &lt;/span&gt;
</code></pre>

<p>What I am testing is when the user hits enter key to take the user to my search page, I find the code works correctly in that it finds the correct keyCode and when getting to the redirect function but it just refreshes the page rather than go to it.</p>

<p>Any ideas ?</p>

<p>Edit it works fine with onclick its the enter key stroke that doesnt work</p>

<pre><code>    searchBox.find("a").click(function () {
        submitSearchValueFromTextBox(searchBox, baseURL);
    });
</code></pre>
