I'm put an image, which when it clicks it will delete some data on the
database

<img src="template/default/images/removeGray.gif" id="remove"
onClick="removeEdu(13)">

On above example, when user click it will delete data with id = 13 on
database.

This is the function

function removeEdu(id) {
                $('#dialog').dialog('open');
                  return false;
}

And this is for the dialog

$("#dialog").dialog({ [...]})

I use a similar approach, not tested, but should works:

<img src="template/default/images/removeGray.gif" id="remove_13" 
class="removeButton" />

$('.removeButton').click(function() {
id = this.id.replace('remove_', '');

 $("#dialog").dialog({
                        autoOpen:false,
                        bgiframe: true,
                        resizable: false,
                        width : 250,
                        modal: true,
                        overlay: {
                                backgroundColor: '#000',
                                opacity: 0.5
                        },
                        buttons: {
                                'Delete': function() {
                                        $.post("ajax.php", { id : id 
},function(){
                                                        $('#edulist').empty();
                                                        
$('#edulist').load('show.php');
                                        } );
                                        $(this).dialog('close');
                                },
                                Cancel: function() {
                                        $(this).dialog('close');
                                }
                        }
                });

});


Bye

--
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482

Reply via email to