I am trying to get a content appear after sometime after making an ajax request with jQuery but I am getting some trouble with it.
Here is the code:
$.ajax({
url: 'content.php',
data: '&go=' + tab,
success: function(data) {
setTimeout("pencil()",3250);
setTimeout('$("#content").html(data).fadeIn()',5000);
}
});
The problem is that the “content” is not loaded this way after 5 seconds. However if I put it without the setTimeout it appears right away – but that way it smashes the animation.
How can I fix this?
Thank you.
You need to wrap your jQuery call in a function