I have a calendar control on my site. It fetches some availability data from the server using some ajax request. Here is the code -
var monthlyBookingDetails = getBooking(month, year);//getBooking is ajax function
//rest of code
Here in the getBooking function if i make async: false, it works but browser is blocked till the ajax request is serviced.
So I thought of a turn around as -
while(monthlyBookingDetails.length <= 0){//busy waiting}
But I feel this is not the proper way, so just want to understand what is the correct way to do busy waiting and block the following lines to execute.