What I need is when the user types his query in the search Box.
<form class="navbar-search pull-left">
<input type="text" autocomplete="off" autofocus id="query" class="search-query search_input" placeholder="Type your query...">
</form>
I dont have a Button to submit the form. I want the form to be submitted when the user presses the Enter Key. And when the user presses the Enter key I want the Query to be shown in the URL. Like the URL before the submission
http://example.come/
And when the user enters his text and presses the enter key. I want the query to be displayed in the URL like this
http://example.come/#query
Without reloading the whole. Is this possile using the Javascript or Jquery or whatever is more easy.
Edit: Here's what I tried window.location.hash = get_query ;
if (get_query.length != 0) {
$("#query").val(get_query);
$('.search_input').trigger('keyup'); // This is the Event which triggers
}