0
i have 2 functions being called within another, the problem that the second function depends on some elements that comes from the first function. The 1° function makes an ajax request that takes a certain time in seconds, and the problem is there. This going to second function without first closing the first, and this hinders the functioning of the second function. Example:
function gerador(){
funcao1();
funcao2();
}
has some way of calling function 2 when closing function 1? remembering that I can not change the structure of functions, I can only call them. So I have to have a solution outside of them.
What you describe is a case of XY problem. AJAX has its own mechanism for you to detect the success of the request and execute something (
onreadystatechange
). One searched by AJAX here on the site will have examples. Please provide a [mcve] of the problem if the current site posts are not sufficient. Links to better understand how Sopt works: [Tour], [Ask], Manual on how NOT to ask questions and [Help]– Bacco