As you know that ajax is asynchronous (happening at different times), that means say if i have two functions called in a sequence, one is for the ajax - goes to the server and fetches the data, and second one is to refresh the targetDiv to display the result, but the problem is that, if the internet is slow, the first one waits for the reponse from the server while the otherone refreshes the page even though the response is not received. and when the response is received, the targetDiv is not refreshed.
How can i call functions in sequence, say call a function or functions after the response is received.