解决方案 »

  1.   

    用同步的
    .ajax({
             url: url,
         type : "get",async:false,
         dataType:'jsonp',
         jsonp:"jsonpCallback",
             success: function(result) { 
                  //parse result , logic
                 //logicFun(result , index );
                 console.log('rendering - '+index);
            }
      

  2.   


    本人需求明确不能同步,同步就不必这么调用ajax了
      

  3.   

    看下这个http://www.jb51.net/shouce/jquery1.82/jQuery.when.html
    http://www.cnblogs.com/charling/p/3411385.html
      

  4.   

    自己写代码来控制执行循序,而不是直接for,each并发执行,做递归调用    function loads() {
            var initPath = 'http://192.168.81.177:8089/di-data-service/';
            var reports = ['cpu_report', 'mem_report', 'load_report', 'network_report'];
            var currentPath = initPath + 'r=day&json=1&cName=';        rendering(currentPath, 0, reports);
            /*
            $.each(reports, function (index, report) {
                rendering(currentPath + report, index);
            })*/
        }    function rendering(currentpath, index,reports) {
            $.ajax({
                url: currentpath + reports[index],
                type: "get",
                dataType: 'jsonp',
                jsonp: "jsonpCallback",
                success: function (result) {
                    //parse result , logic
                    //logicFun(result , index );
                    console.log('rendering - ' + index);                index++;
                    if (index < reports.length) rendering(currentpath, index, reports);            }
            });
        }    function logicFun(data, index) {
            //parse data  , logic
            console.log('logicFun - ' + index);
        }
      

  5.   

    将要发送的数据和地址放到一个数组里 
    每次ajax返回成功pop后递归执行发送方法试试