我的文件js有一个问题,它调用了多个http请求。 我有一个按钮,调用该函数VisualizzaReport这是在我的文件visualizzaReport.js同一个js文件发出的多个http请求
下面是函数VisualizzaReport(选择是用户的ID)
function visualizzaReport(select){
reportUtente(select)
loadPianificazione(select)
}
这里的功能reportUtente(选择)
function reportUtente(select) {
var url = "../loadReportUtenteServlet?";
url += "type=perso_atti&value=" + select.value;
xmlhttp.onreadystatechange = handlerForReportUtente;
xmlhttp.open("GET", url);
xmlhttp.send("");
}
在这里,函数loadPianificazione(选择)
function loadPianificazione(select) {
var url = "../loadPianificazione2Servlet?";
url += "type=pianificazioni&value=" + select.value;
xmlhttp.onreadystatechange = handlerForPianificazioneUtente;
xmlhttp.open("GET", url);
xmlhttp.send("");
}
我的问题是,功能reportUtente启动,但没有效果,因为它似乎是由loadPianificazione函数替代。 只有当reportUtente完成执行时,我如何才能调用loadPianificazione?