How to get selected jQuery ui slider values

I use the jQuery ui slider http://jqueryui.com/demos/slider/#range , in which there are two values ​​that are obtained when performing the slide (range selection), then how to get these values ​​in jQuery variables and only after selecting the range? I have to make an ajax call after this, I get these values. can someone help me with this, how to get these values ​​only after completing the selection of both ranges?

I use this jQuery ui function to launch the slider

$(function() { $( "#slider-range" ).slider({ range: true, min: 0, max: 500, values: [ 75, 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 ) ); }); 
+4
source share
1 answer
 $(function() { $( "#slider-range" ).slider({ range: true, min: 0, max: 500, values: [ 75, 300 ], slide: function( event, ui ) { $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] ); }, change: function(event, ui) { // when the user change the slider }, stop: function(event, ui) { // when the user stopped changing the slider $.POST("to.php",{first_value:ui.values[0], second_value:ui.values[1]},function(data){},'json'); } }); $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) + " - $" + $( "#slider-range" ).slider( "values", 1 ) ); }); 
+13
source

All Articles