I want to get fetch some data via jQuery.ajax(),save this data via the success and then use it.
The order of the functions is:
$.ajax({
url: this.html_url,
cache: false,
success: function(data){
//Here the data is saved via HTML5 localStorage
}
});
doSomething();//The stored data is used in this function.
The problem is that doSomething() is called BEFORE the success function has saved the downloaded data. Thus, the data is being used before it has even been saved. Can anybody help?
this is because
ajaxcall is madeasynch. setasync : falsein your ajax call bydefaultit istrue.DOCUMENTATION
Second way to call
doSomethinginside thesuccess