Click here to Skip to main content
15,905,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys,

How can I remove existing table that was sent from a web server?. Basically I have a table filled with data that comes from a web server? I tried the append() but what happened is the new table did just displayed under the original table. So I'm looking for a way to delete the original table so only the new table will show.

Thanks,
Posted
Comments
_Asif_ 13-May-14 2:18am    
I do not understand, can you please provide an example!
KatsuneShinsengumi 13-May-14 2:26am    
T_T,. If you tried to search on google, you'll see the results below right? what I'm trying to do is when you did another search the results below should be deleted and be replaced with the new one. That's why I'm looking for a way to delete a table.
Madhanlal JM 13-May-14 2:30am    
Try removing the existing content before append the new result.
Like $("#yourDiv").html("").append("your new content")
KatsuneShinsengumi 13-May-14 2:38am    
Thank you very much, I happend to bump in the same conclusion but I used the the remove() from jquery.

1 solution

Hey guys I got it now,

JavaScript
$('.actualResults').remove();
                      $.each(smg, function(i, item) {
                      $('#ResultTable').append( '<tr><td>' + smg[i].Title + '</td><td>' + smg[i].EntryDate + '</td>\n\
                       <td>' + smg[i].id + '</td><td>' + smg[i].GenreName+ '</td></tr>' );
                      });


I use the remove function from the jquery and then render the new data with loop.

Thanks,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900