Hi all,

I'm running into some trouble using the jquery $.post function. I'm
using it in my CMS to delete a page record and after the deletion to
display the updated page with the just deleted page removed ofcourse.
Needless to say AJAX comes in handy here because of the page refresh.

Here's my code;

$(document).ready(function(){

$('p.editblock a.del').click(function()
{
        var table_id = $(this).parent().parent().attr('id').split('_');

        if(confirm("Are you sure?"))
        {
                $.post('includes/inc/ajax/handledelete.php', { table: 
table_id[0],
id: table_id[1] }, function(data)
                {
                        $('#sitewrapper').html(data);
                });
        }

        return false;
});

});

So the php file handles the delete query with the database and in the
callback I'm replacing all the #sitewrapper html with the output of
the php file. This does work, and the page does get displayed properly
(with the deleted item removed) but after that the code stops working.

So if I'd want to delete another one it won't function, it doesn't
even take the "false;" statement for the link instead of that it just
follows the location of the href. If I do a refresh in the browser it
works again but only for once to fall in the old pattern again...

Anyone who can help me with this?

Reply via email to