Reputation: 9855
I use AJAX to insert data into my table, once this is done however I want my new value to fade in, inplace of the existing .html data.
I have the following only it doesnt seem to fade in...
// UPDATE INCOME
$("#salary-upd").on("submit", function(event) {
event.preventDefault();
var elem = $(this);
$.post("update_salary.php", $(this).serialize(), function(data) {
$(".spends").fadeIn().html(data);
});
Upvotes: 1
Views: 185
Reputation: 79830
Try,
$(".spends").fadeOut('slow', function() {
$(this).html(data).fadeIn('slow');
});
Upvotes: 1
Reputation: 102783
Try this one. Set the initial value to start, then do the animation explicitly:
$(".spends").css('opacity', 0).animate( { opacity: 1 }, 'slow');
Upvotes: 0