I am trying to improvise a piece of code by delaying an execution.
$(document).ready(
function testFunc(){
setTimeout(function(){console.log("something happening...")},1000)
}
$.when(testFunc()).done(function(){
//this code executes immediately, shouldn't it be executed after 1 sec or 1000 milliseconds
$('#tWrapper').removeClass("d-none");
$('#spinnerrr').remove();
});
});
So I want to do something (in my case to remove some class or HTML elements) after one function is finished (which will be an ajax call, but for now I am improvising the AJAX call with a code delay) but with the $.when() function the inside functions execute immediately.