I am using Jquery tools, overlay effect and want to close it, if JSON response is OK, but i want to do it with a delay.
$.ajax({
//bla bla
success: function(data){
var obj = jQuery.parseJSON(data);
if (obj.status=='OK')
{
$('#status').text('bla bla');
jQuery('.close').trigger('click');
}
else
{
$('#status').text('bla bla');
}
}
});
so this – jQuery(‘.close’).trigger(‘click’); must be executed after some time. Any ideas?
setTimeout()is a native JavaScript function designed for this purpose.The last number there is the delay time in milliseconds.