Wait for the content to fadeIn a div with jquery ajax -


i have div, button.

  1. when press button fadeout() div
  2. i load content page, jquery ajax()
  3. when content loaded, want put content div
  4. only then, fadein() div.

for now, use this:

success: function (data) {      $('#inside-choice').html(data);      $('#inside-choice').fadein('slow'); }, 

but syntax, fade in can start before content totally loaded. how wait until content loaded before fading in div?

use promise() :

success: function (data) {      $('#inside-choice').html(data).promise().done(function(){        $('#inside-choice').fadein('slow');      });  }, 

https://api.jquery.com/promise/


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -