我創建了一個圖表,我想實時更新,這就是爲什麼我使用ajax。我的問題是,如何顯示ajax響應?以下是我的圖表示例腳本。請幫幫我。非常感謝。如何顯示ajax響應
Chart.php -
$(document).ready(function() {
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: "TITLE"
},
series: [{
name: 'Present',
data: [*//must display the ajax response here//*]
}]
});
});
ajax.php
<script>
function fanc_no(){
$.ajax({
url: "test.php",
success: function(result){
$("#container").html(result);
}
});
}
window.setInterval(function(){
func_no();
}, 1000);
</script>
[使用Ajax將數據加載到Highcharts中]可能的副本(https://stackoverflow.com/questions/12223972/load-data-into-highcharts-with-ajax) –