Damien Damien - 1 year ago 84
jQuery Question

Wait for the content to fadeIn a div with jquery ajax

I have a div, with a button.

  1. when I press the button I
    the div

  2. I load content from another page, with jQuery

  3. when the content is loaded, I want to put this content into the div

  4. only then,
    the div.

For now, I use this:

success: function (data) {

But with this syntax, the fade in can start before that the content is totally loaded. How do I wait until the content is loaded before fading in the div?

Answer Source

use promise() :

success: function (data) {



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download