[eluser]jikowhitewolf[/eluser]
After working with Flexigrid, I notice I have 4 delete.php scripts needed for 4 different tables update.
I wish to ask if there is anyway I can pass a param of the database table name to delete php, so that 1 delete.php can handle any table query to delete the item by id.
I am very new with jquery and json, hope to get any advice on this.
Code:
function deleteRecord(com,grid)
{
if (com=='Delete')
{
if($('.trSelected',grid).length>0)
{
if(confirm('Delete ' + $('.trSelected',grid).length + ' items?'))
{
var items = $('.trSelected',grid);
var itemlist ='';
for(i=0;i<items.length;i++)
{
itemlist+= items[i].id.substr(3)+",";
}
$.ajax
({
type: "POST",
dataType: "json",
url: "delete.php",
data: "items="+itemlist,
success: function(data)
{
$("#flex1").flexReload();
}
});
}
}
else
{
return false;
}
}
}