Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I think your problem is that your <code>$.ajax({...})</code> is being called too early - ie. on document ready <code>$(function (){ ... $.ajax({...}) });</code>, and not after your sliders are changed/selected. You could call your <code>$.ajax({...})</code> on a button click -</p> <pre><code>&lt;input id="vote" type="button" value="Vote" /&gt; $("#vote").on('click',function(){ var a= $("#min_inches").val(); var b=$("#max_inches").val(); $.ajax ({ type: "POST", url: "searchrange.php", data: { a : a, b : b }, success: function(option) { alert("voted"); } }); }); </code></pre> <p>so your code could be - </p> <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" /&gt; &lt;script type="text/javascript"&gt; $(function () { $("#slider-range").slider( { range: true, min: 71, max: 109, values: [75, 100], slide: function (event, ui) { $("#size-range").html(Math.floor(ui.values[0] / 12) + "'" + (ui.values[0] % 12) + '" - ' + Math.floor(ui.values[1] / 12) + "'" + (ui.values[1] % 12) + '"'); $("#min_inches").val(ui.values[0]); $("#max_inches").val(ui.values[1]); } }); $("#size-range").html(Math.floor($("#slider-range").slider("values", 0) / 12) + "'" + ($("#slider-range").slider("values", 0) % 12) + '" - ' + Math.floor($("#slider-range").slider("values", 1) / 12) + "'" + ($("#slider-range").slider("values", 1) % 12) + '"'); $("#min_inches").val($("#slider-range").slider("values", 0)); $("#max_inches").val($("#slider-range").slider("values", 1)); $("#vote").on('click',function(){ var a= $("#min_inches").val(); var b=$("#max_inches").val(); $.ajax({ type: "POST", url: "searchrange.php", data: { a: a, b: b }, success: function (option) { alert("voted"); } }); }); }); &lt;/script&gt; </code></pre> <p>see this JSFiddle example (using alert in place of $.ajax()) -<a href="http://jsfiddle.net/8JgW6/" rel="nofollow">http://jsfiddle.net/8JgW6/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload