Ajax调用文档准备好了

Im having problems with my ajax call loading on document.ready but when I incorporate a window. scroll function the ajax call is successfully rendered any suggestions on how I can tweak my code. I can't provide a fiddle for this one because I don't no how to include anychart in the fiddle here is a snippet of my code:

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("
"+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();

});
查看全部
weixin_33698823
weixin_33698823
2013/10/30 08:49
  • ajax
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

2个回复