You cannot get javascript data like your code above, but you can use this ,
you can use jquery then use ajax
$.ajax({
url: 'your url to receive data or whatever',
type: 'POST / GET depend on your need',
dataType: ' can be json, text , or something else',
data:some data you wanna send to,
success:function(data){
console.log(data);
},
error: function(xhr, ajaxOptions, thrownError){
console.log(thrownError);
}
example :
var slider=$('#myRange');
slider.on('input',function(){
$.ajax({
url: 'http://example.com/intime', // Your url for receive data
type: 'POST',
dataType: 'text',
data:{slide:slider.val()},// You can send multiple data like {test:test1,test2:test2, ...}
success:function(data){
console.log(data);// you can change this for your own function or whatever
},
error: function(xhr, ajaxOptions, thrownError){
console.log(thrownError); // If error thrown here
}
});
on server side :
$slider=$_POST['slide']; //Get slide from ajax
echo $slider; //you can use this var for proccessing or get query. etc.