I´m using the jQuery Slider plugin. The current selected value of the slider should be send with AJAX to a server sided script.
At the moment I´ve a wrong behaviour. The current selected value is always one value infront or behind the value which is send with AJAX.
For example: If you slide to the value 5/ 50 it will send "6" instead of "5" to the server sided script.
I´ve made a JS Fiddle. Just look under the developers network tab.
// Slider Script
$("#slider-vertical").slider({
orientation: "horizontal",
range: "min",
min: 1,
max: 50,
value: 50,
slide: function (event, ui) {
$("#amount").val(ui.value);
},
});
$("#amount").val($("#slider-vertical").slider("value"));
// Get Response
$('#slider-vertical').on('slide', getResponse);
getResponse(0);
function getResponse() {
let itemlevel2 = $("#slider-vertical").slider("value");
ajaxManager.add({
type: "GET",
cache: "true",
url: "itemscript.php",
data: {
"itemlevel": itemlevel2
},
success: function (data) {
}
});
}
});