[jQuery] Clone <tr> w/ New Data
I have a table set up like so:
<table id="groups">
<tr>
<td>Group Name</td>
<td>Options</td>
</tr>
<tr>
<td class="tbldata"></td>
<td class="tbldata"></td>
</tr>
</table>
I'm using Impromptu to pop up a message when you click "Add New
Group". You type in the group name, and then submit. It posts to a
PHP file, and then returns that posted info in JSON format.
How do I put in that data that is returned into the two empty td
columns?
here is the jQuery code I have so far - and it does duplicate my last
TR, which is what I want..but now I need that data that is returned to
me from my PHP file:
$.post("addressbook_addgroup.php", { groupname:f.groupname },
function(data){
$("#groups tr:last").clone(true).insertAfter("#groups tr:last");
}, 'json');
So when all is said and done, my last TR there would return a NEW tr
that looks like this:
<tr>
<td class="tbldata">New Group Name</td>
<td class="tbldata">edit</td>
</tr>