Using jquery remove() with id passed by variable. Possible?

AroJazz

New Member
This is the function\[code\]function deleteItem(id) { $.post("_asyncpage.php", {id:id}, function (result) { if (result == true) { $('#'+id).remove(); } }, "json"); }\[/code\]So, to explain, the function receive an id, send to a page that execute random stuff on a db and return true/false.The function inside check for result that can be true/false as said before.If true proceed to remove the dom element that match the id passed.The db is updated correctly but the .remove() won't work... someone knows why? :(The following is an example of the html structure. the table inside the TD is the one to be deleted.\[code\]<td width="120" valign="top" id="13_02"> <table cellspacing="0" cellpadding="0" class="tableProg" id="1"> <tbody> <tr> <td colspan="3"><h4 style="margin: 0pt;">Title</h4></td> </tr> <tr> <td colspan="3">h. 13:35</td></tr><tr><td width="74"><span style="font-weight: bold; color: rgb(0, 102, 204);">Su</span>: TV</td> <td width="22"><a href="javascript:openEditItem('2010/08/24','1')"><img src="http://stackoverflow.com/questions/3566672/static/images/edit.gif"></a></td> <td width="22"><a href="javascript:deleteItem('1')"><img src="http://stackoverflow.com/questions/3566672/static/images/delete.gif"></a></td> </tr> </tbody> </table></td>\[/code\]
 
Back
Top