I need to execute 2 functions one after the other with the stuff in function "A" fully completing before the stuff in function "B" executes...
I can't find an example that is not using setTimeout .. which is strange ...
I have the following example below ( from here ) , is it supposed to work ?? How could I test if it is working ? What dummy code could I use to simulate the part "//do stuff with SharePoint JSOM" taking 5 secs to 30 secs ,say .
var a = function() {
var defer = $.Deferred();
//do stuff with SharePoint JSOM
console.log('a() called');
return defer;
};
var b = function() {
var defer = $.Deferred();
console.log('b() called');
return defer;
};
a().then(b);