I have the following script:
$(function() {
$(".message").hide();
function simulate_ajax_call()
{
$.ajax({
url: "/echo/json/",
success: function(){
alert("done");
$(".message").empty().html("done");
$(".message").delay(1000).fadeOut(500);
}
});
}
$('.button').click(function() {
$(".message").fadeIn(500);
setTimeout("simulate_ajax_call()", 5000);
});
});
With the following HTML:
<input type="button" value="button" class="button" />
<div class="message">loading...</div>
For some reason the setTimeout
part is not working. i.e. it does not seem to call the function after 5000ms.