The problem with appending something to window.location.href
is what if you have already done that? You'll just keep appending "?search=..."
multiple times. More importantly, it's more complicated than it needs to be.
You're already using jQuery. Why not just do this?
<form id="search" method="get">
<input type="text" name="search">
</form>
<a href="#" id="go">Search</a>
with:
$(function() {
$("#go").click(function() {
$("#search").submit();
return false;
});
});
and then you don't have to worry about the right URL, encoding, etc.