Let's say I have the following function getData
getData = (param) => {
// jquery
$.ajax(...).done(..)
}
How do I turn getData
into a blocking function so that refreshPage
only gets called after the ajax within getData
is done?
data = getData(..)
refreshPage()
Please note: I don't want to pass refreshPage
into the ajax callback within getData
OK... here is what I tried and seems working:
getData = (param) => {
// jquery
return $.ajax(...).done(..)
}
getData.then(refreshPage())