title: jquery range slider values to query string
body: <p>I am using the jQuery UI range slider demo code (<a href="http://jqueryui.com/demos/slider/#range" rel="nofollow">http://jqueryui.com/demos/slider/#range</a>) to create a price range slider. I want to transfer the values selected from this range slider to the get params of <code>minValue</code> &amp; <code>maxValue</code>.</p>
  
  <p>I have been trying to do this by getting the JavaScript to update the hidden fields in the form below but this doesn't seem to work as at the moment the page reloads with the URL query string looking like this: <code>?minValue=&amp;maxValue=&amp;submit=go</code> and no values have been transferred from the range slider. How do I get the values from the range slider to the query string?</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
  $(function() {
      $( "#slider-range" ).slider({
          range: true,
          min: 1,
          max: 3000,
          values: [ 1, 300 ],
          slide: function( event, ui ) {
              $( "#amount" ).val( "£" + ui.values[ 0 ] + " - £" + ui.values[ 1 ]);
          }
      });
      $( "#amount" ).val( "£" + $( "#slider-range" ).slider( "values", 0 ) + " - £" + $( "#slider-range" ).slider( "values", 1 ) );
      $( "#minValue" ).val( ui.values[ 0 ] );
      $( "#maxValue" ).val( ui.values[ 1 ] );
  });
  &lt;/script&gt;
  
  &lt;form action=""&gt;
      &lt;div id="slider-range"&gt;&lt;/div&gt;
      &lt;label for="amount"&gt;Price range:&lt;/label&gt;&lt;input type="text" id="amount" style="border:0; color:#28b1ff; font-weight:bold;" /&gt;
      &lt;input id="minValue" name="minValue" type="hidden" /&gt;
      &lt;input id="maxValue" name="maxValue" type="hidden" /&gt;
      &lt;input id="randomGiftButton" type="submit" name="submit" value="go" /&gt;
  &lt;/form&gt;
  </code></pre>