Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
171
rated 0 times [  175] [ 4]  / answers: 1 / hits: 17177  / 13 Years ago, thu, june 30, 2011, 12:00:00

I would like to do some effects like fadeIn to page once I get the ajax response.
I tried this,



$.ajax({
type: post,
url: actionLink,
cache: false,
data: ....someData....,
success: function(data) {
$(.response).fadeOut(100);
$(.response).html(data);
$(.response).fadeIn(500);
}
});


This is working but data is displayed first and with a flash of 500ms getting data with fade effect but I need to get the loaded data directly with fade effect.



I even tried with Fade out a div with content A, and Fade In the same div with content B, but I still get the same issue.



I also tried:



$(.response).fadeOut(100).hide();
$(.response).show().html(data).fadeIn(500);


Still the same. How do I fix this?


More From » jquery

 Answers
82

This thing worked.........



jQuery(.response).fadeOut( 100 , function() {
jQuery(this).html( data);
}).fadeIn( 1000 );

[#91426] Tuesday, June 28, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
madelyn

Total Points: 449
Total Questions: 100
Total Answers: 100

Location: Seychelles
Member since Fri, May 7, 2021
3 Years ago
madelyn questions
Wed, Jul 28, 21, 00:00, 3 Years ago
Wed, Jul 14, 21, 00:00, 3 Years ago
Sat, Nov 7, 20, 00:00, 4 Years ago
Thu, Sep 3, 20, 00:00, 4 Years ago
;