Now, i'm currently using google visualisation charts to draw out the data from my database. I have a dropdown box for users to select the year and I want to change the chart data based on the year WITHOUT refreshing the whole page.
I'm not really clear on exactly how to make use of ajax do redraw the chart from the option the user select.
<script>
$(document).ready(function()
{
var txt = $(this).val();
$.ajax({
url:"index.php",
method:"post",
data:{search:txt},
dataType:"text",
success:function(data)
{
$('#result').html(data);
}
});
$('#year').onchange(function()
{
var txt=$(this).val();
$.ajax({
url:"index.php",
method:"post",
data:{search:txt},
dataType:"text",
success:function(data)
{
$('#result').html(data);
}
});
});
});
</script>
I am using a session variable to store the value of what the user select -
<form method="post">
<?php
if (isset($_POST['year']))
{
$_SESSION['year'] = $_POST['test'];
}
?>