我的文件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?