This commit is contained in:
fencl
2024-01-02 10:39:28 +01:00
parent 2cfc1b1d7b
commit aa4ce5c604
4 changed files with 116 additions and 0 deletions

View File

@@ -11,9 +11,30 @@ $(function() {
$("#amount").text(ui.value);
localStorage.setItem("sliderValue", ui.value.toString());
updateFace(ui.value);
saveDataToServer(ui.value);
}
});
function saveDataToServer(value) {
// Data k odeslání na server
var dataToSave = {
sliderValue: value,
};
$.ajax({
type: "POST",
url: "saveData.php", // Název skriptu na serveru
contentType: "application/json",
data: JSON.stringify(dataToSave),
success: function(response) {
console.log(response);
},
error: function(error) {
console.error(error);
}
});
}
var savedValue = localStorage.getItem("sliderValue");
if (savedValue) {
slider.slider("value", parseInt(savedValue));