sridhar sridhar - 2 months ago 22
jQuery Question

Jquery for set timeout

I have an existing jquery code that calls for showing up div contents. Here is it:

$.ajax({
url: 'sendform.php?action=datapp',
type: 'POST',
data: data,
success: function (response) {
if (response == 'SUCCESS') {
$('#FormA').show();
$('#FormB').hide();
}
},


Now, I want to add a line here that starts a timer (timeout), which shows FormC after 20 seconds. Please help.

Answer

Try adding below script for showing Formc after 20 secon.

setTimeout(function(){ $('#FormC').show() }, 20000);
Comments