I have three async ajax calls functions with callback functions for fetching info to the main page. Those functions are on another js file.
Ajax_GetUsers(Fetch_Users);
Ajax_GetContactTypes(Fetch_ContactTypes);
Ajax_GetCasePriorities(Fetch_CasePriorities);
After those three finish fetching the results i want to do one more call to this function :
Ajax_GetCaseData(selectedCaseId, Fetch_CaseData)
This is the code i created but still does not work . The Ajax_GetCaseData sometimes is called before the others . How can i make sure that the Ajax_GetCaseData will be always executed after the other three asynchronous functions : Here is my Code :
$.when(Ajax_GetUsers(Fetch_Users),Ajax_GetContactTypes(Fetch_ContactTypes),
Ajax_GetCasePriorities(Fetch_CasePriorities))
.then(function () {
Ajax_GetCaseData(selectedCaseId, Fetch_CaseData);
});