javascript - Appending to URL end with JS request on form change -


my code follows:

<h1>sort by</h1> <form> <select name='myfield' onchange='this.form.submit()'> <option value="relevance">relevance</option> <option value="date">date posted</option> </select> <noscript><input type="submit" value="submit"></noscript> </form> 

whenever change form , auto-submits, new field "myfield" added url end. how can url remain same, , add "myfield" query end of url, not deleting existing url query strings?

store url parameter values in hidden field same name ex:

url: http://localhost/test.php?myfield1=x

<h1>sort by</h1> <form>     <input type='hidden' name='myfield1' value='<?php echo $_get['myfield1']; ?>' />      <select name='myfield' onchange='this.form.submit()'> <option value="relevance">relevance</option> <option value="date">date posted</option> </select> <noscript><input type="submit" value="submit"></noscript> </form> 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -