I’ve been sending ajax for a long time, but this wasn’t: it’s sent only once, and then when I click on the div (.msgdel class) it just reloads the page.
$('.msgdel').click(function () { var id = $(this).attr('id'); var data = "comid=" + id; alert(data); $.ajax({ type: "POST", url: "comdel.php", cache: false, data: data, success: function (html) { $('div#commentsdiv').load("# div#commentsdiv"); } }); return false; });
How to fix this line? Without it, everything is in order. How to update a specific div?
$('div#commentsdiv').load("# div#commentsdiv");