I have an HTML slider called myRange
that represents years. I want to get the value and print it in this field when I click a button:
<div id="test">HELLO</div>
I read the value in the script:
var slider = document.getElementById("myRange");
function post()
{
var year = slider.value
$.post('year.php', {slideryear:year},
function(data){
$("#test").html(data);
});
}
And this is the year.php
file:
<?php
$year = $_POST['slideryear'];
?>
When I click the button to show the number in the id="test" paragraph, the paragraph goes blank ("HELLO" disappears). My first attempt with PHP, what am I doing wrong?
I'm running on Apache.