我在 document.ready 上加载 ajax 调用时遇到问题,但是当我合并一个窗口时。滚动功能 ajax 调用已成功呈现有关如何调整代码的任何建议。我无法为此提供小提琴,因为我不知道如何在小提琴中包含任何图表,这是我的代码片段:
function DataStreamer(){
$.ajax({ // then make an AJAX-request
async: false,
cache: false,
url: '/APAC/TW/Resources/js/gethistoricalpricing.js',
dataType: 'json', // csv data is text
success: function(resp) { // "resp" variable is a response to AJAX-request
// Append new data into the 'ds1' data set
var line = [], json = resp, i= 0;
for (i; i < resp.length; i++) {
rawDate = json[i]['Date'].split('/');
hisDate = rawDate[2] + rawDate[0] + rawDate[1];
hisPrice = json[i]['Price'];
line.push("\n"+hisDate + "," + hisPrice);
}
chart.appendData('ds_prices', line);
// getSeriesById method returns 's1' series 'main' chart,
// you can also use full path to the series through the objectModel, but this way is shorter
chart.commitDataChanges();
}
})
}
$(document).ready(function(){
DataStreamer();
});