将一个ajax请求放到另一个ajax请求的回掉函数中,也就是让他们顺序执行试试.

解决方案 »

  1.   

    <script>
    window.onload=getComList( <?=$classid?>, <?=$id?>,1);
    </script> ---------------------------------这是两个函数
    function getComPage(classid,id,pagenum){
    var url = '/e/ajax/index.php?';
    var params ='action=getComPage' +  '&classid=' + classid + '&id=' + id + '&pagenum=' + pagenum;
    url+=params;
    var functionName=function (){    
    if(xmlHttp.readyState==4){
    if(xmlHttp.status==200){
      if(xmlHttp.responseText!=0){
    alert(xmlHttp.responseText);
        $(".comnav1").html(xmlHttp.responseText);
      }
      else {
    $(".comnav1").html(""); 
      }
    }
    }
    };
    makeRequest(url, functionName, "GET", '');
    }
    function getComList(classid,id,pagenum){
    var url = '/e/ajax/index.php?';
    var params ='action=getComList' +  '&classid=' + classid + '&id=' + id + '&pagenum=' + pagenum;
    url+=params;
    var functionName=function (){    
    if(xmlHttp.readyState==4){
    if(xmlHttp.status==200){
      if(xmlHttp.responseText!=0){
        $("#commentinfo").html(xmlHttp.responseText);
      }
      else {
        $("#commentinfo").html("");
      }
    }
    }
    };
    makeRequest(url, functionName, "GET", '');
    getComPage( <?=$classid?>, <?=$id?>,1);//调用

    试一下  看看
      

  2.   

    onload你试头调用两次
    你这写法不对的
    onload=function()
    {
      getComList( <?=$classid?>, <?=$id?>,1); 
    getComPage( <?=$classid?>, <?=$id?>,1); 
    }