I have this code :
$(document).ready(function(){
doSomething();
var a = getSomething();
})
function doSomething(){
$.ajax(
//insert something to database here
)
}
How do I make sure doSomething()
has already finished its ajax call before calling getSomething()
without using async: false
or changing the code inside doSomething()
method?