0
我有一些問題,當我使用anychart與Ajax。 由於anychart的數據依賴於check_box用戶選擇,我必須ajax數據。 圖表的基本形式很好,但選定的數據在圖表上不起作用動態anychart與ajax
這是我的代碼。
<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>
和我的Ajax和AnyChart的設置如下
<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>
我在想,我要重新描繪的AnyChart的,因此AJAX數據可以加載,但我不知道如何使其工作
你能分享一份工作(不工作的樣本)嗎? –