I have some problems when I using anychart with ajax. Because data of anychart is dependent on the check_box users select, I have to ajax the data. the basic form of chart is fine, but selected data do not work on the chart
Here is my code.
<body>
<div>
<input type='checkbox' name='question_id' value='1'>
<input type='checkbox' name='question_id' value='2'>
<input type='checkbox' name='question_id' value='3'>
<input type='checkbox' name='question_id' value='4'>
<input type='checkbox' name='question_id' value='5'>
<input type='checkbox' name='question_id' value='6'>
<div>
<button id='report'>report</button>
<div id='container'></div>
</body>
and my ajax and anychart setting is as below
<script>
$(function() {
$('#report').click(function() {
$.ajax({
type: 'POST',
data: {
ids: $("input[name='question_id']:checked").map(function () {
return $(this).val();
}).get()
},
});
});
});
anychart.onDocumentReady(function() {
var dataSet = anychart.data.set(<%= select_data %>);
var chart = anychart.column();
......
......
chart.container('container');
chart.draw();
});
</script>
I am thinking that I have to rerender the anychart so the ajax data could be loaded, but I have no idea how to make it work