function getDataValeurRange() {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
          document.getElementById("value").innerHTML = this.responseText;
          document.getElementById("ValueRange").value = this.responseText;        
        }
    };
    
    xhttp.open("GET", "read_ValueRange", true);
    xhttp.send();
};
getDataValeurRange();


document.addEventListener('DOMContentLoaded', (event) => {
  const selectElement = document.querySelector('#ValueRange');
  if (selectElement) {
    selectElement.addEventListener('change', (event) => {
      const result = document.querySelector('#value');
      if (result) { 
        result.innerHTML = selectElement.value
      }
    });
    selectElement.addEventListener('input', (event) => {
      const result = document.querySelector('#value');
      if (result) { 
        result.innerHTML = selectElement.value
      }
    });
  }
});


$(document).ready(function () {
    $("#ValueRange").change(function () {
        var valeur = $("#ValueRange").val();
        $.post("write_ValueRange", {
            ValueRange: valeur
        });
    });
});




