这就是我所拥有的:
function loadGraphs(datawijk){
    $.ajax({                                      
      url: './api5.php',                  //the script to call to get data          
      data: {
       wijk: datawijk,
        },                        //you can insert url argumnets here to pass to api.php
                                       //for example "id=5&parent=6"
      dataType: 'json',                //data format      
      success: function(rows)          //on recieve of reply
      {
        var htmlContent = "";
        // ADD TO 
        htmlContent += '<tr><th scope="row">Geboortes</th>';
        $.each(rows, function(i, data) {
          $.each(data, function(j, year) {
            htmlContent += 
              '<td>' + year + '</td>';
          });
        });
        htmlContent += '</tr>';
        var lol = updateOverlijdens(datawijk, htmlContent);
        alert(lol);
        $('#graphs table tbody').html(htmlContent);
      }   
    });
}
function updateOverlijdens(datawijk, htmlContent){
    $.ajax({                                      
      url: './api4.php',                  //the script to call to get data          
      data: {
       wijk: datawijk,
        },                        //you can insert url argumnets here to pass to api.php
                                       //for example "id=5&parent=6"
      dataType: 'json',                //data format      
      success: function(rows)          //on recieve of reply
      {
        // ADD TO 
        htmlContent += '<tr><th scope="row">Overlijdens</th>';
        $.each(rows, function(i, data) {
          $.each(data, function(j, year) {
            htmlContent += 
              '<td>' + year + '</td>';
          });
        });
        htmlContent += '</tr>';
        return htmlContent;
      }   
    });
}
当我发出警报时(大声笑);在函数 loadGraphs 我得到 undefined ... 当我做 alert(htmlContent); 在函数 updateOverlijdens 中,就在我返回值之前,我做对了。只有当我提醒我的函数 loadGraphs 中的值时,我才会得到未定义。我怎样才能解决这个问题?