Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I set Timeout not based on Time. based on data arrive in javascript.
setTimeout(function () {
$('.loading').addClass('disable');
}, 2000);
This is based on Time. How do I change my code.
Posted
Comments
Peter Leow 20-Mar-15 0:55am    
If you using Ajax, put the settimeout in the success attribute like this:
$.ajax({url: "yoururl",
success: function(result){
// other code
setTimeout(function(){ alert("Hello"); }, 2000);
}});
Refer: http://www.w3schools.com/jquery/ajax_ajax.asp

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900