Rabu, Maret 09, 2011

JQuery : Delete row without reload whole page

Case : You want to delete row of data without reload whole page
Solution : Use JQuery
Script :

function hapus(id){
if (confirm('Yakin mau dihapus ???')) {
$.post('actions/hapus_pengeluaran.php', {id: +id, ajax: 'true' },
function(){
$("#row_"+id).fadeOut("slow");
$('#total_pengeluaran').load('index.php?p=pengeluaran_list #total_pengeluaran');
$('#total_saldo').load('index.php?p=pengeluaran_list #total_saldo');
$('#total_pendapatan').load('index.php?p=pengeluaran_list #total_pendapatan');
});
}
}


Source : http://jquery.com/

0 comments: