title: Change url query string value using jQuery
body: <p>I have an example URL like:</p>
  
  <p><code>http://domain.com/Documents/?page=1&amp;name=Dave&amp;date=2011-01-01</code></p>
  
  <p>The query string contains the current page number and two additional filters (name and date).</p>
  
  <p>Using the following URL parser: <a href="https://github.com/allmarkedup/purl" rel="noreferrer">https://github.com/allmarkedup/purl</a> I am able to access certain parts of the URL such as just the page number.</p>
  
  <p>I'm trying to create a way for a user to be able to type a number into a textbox and then load that page number whilst keeping all the other query strings intact.</p>
  
  <pre><code>$(document).ready(function () {
  
          $('.pageNum').live('keyup', function (e) {
              e.preventDefault();
              if (e.which == 13) {
  
                  var currentUrl = window.location.href;
  
                  var parsedUrl = $.url(currentUrl);
  
                  var currentPageNum = parsedUrl.param('page');
  
                  var newPageNum = $(this).val();
  
                  var newUrl = //
  
                  window.location.href = newUrl;
  
              }
          });
  
      });
  </code></pre>
  
  <p>So when a user hits return on the pageNum textbox, it will get the current page url, parse it, then find out the current page number and then I need a way to replace the value of the page number with the new value in the textbox to create a new url, and then finally refresh the page using this new url.</p>
  
  <p>Is it possible to change the param value and then add it back in?</p>
  
  <p><strong>Note: The additional parameters could be anything, so I can't manually add them onto the pathname with the new page number!</strong></p>