Wern Ancheta
Wern Ancheta

Reputation: 23337

How to animate dynamically generated html in jquery

I'm fetching tabular data from the server using jquery's ajax function. And I'm using the .html function to assign the fetched data inside a div with an id of list_forms. How do I animate it? I'm trying $('#list_forms').html(data).show('slow'); but its not working.

$.ajax({
    type: "POST",
    url: "item_lister.php",
    data: "category=" +  action,
    success: function(data){
        $('#list_forms').html(data);
    }
});

Upvotes: 0

Views: 154

Answers (1)

Pablo
Pablo

Reputation: 6068

Try this

$.ajax({
   type: "POST",
   url: "item_lister.php",
   data: "category=" +  action,
   success: function(data){
       $('#list_forms')
         .hide()
         .html(data)
         .fadeIn();
   }

});

Upvotes: 3

Related Questions