Hi there, Im new to jquery so bear with me... I have a site setup where i can sort content based on keywords in th url. e.g.
www.examplesite.com/keyword
will only show content related to the keyword.
I want to have a form that takes a text input, apends it to a string and when you press enter redirects you to a url based upon the input.
so putting entering 'foobar' and pressing enter sends you to www.examplesite.com/foobar
heres the code i have so far, it will only send me to www.examplesite.com?keyword_search=keyword even though i know that the variable has the correct content.
html
- <form id="search_form"><input type="text" name="keyword_search" value="keyword search"/></form>
javascript
- $(document).ready(function() {
- $('#search_form').submit(function() {
- var goUrl= "http://www.examplesite.com/";
- goUrl = goUrl + $('[name=keyword_search]').val();
- window.location = goUrl;;
- });
- });
best, jon