我正在聊天,我正在通过ajax
$.ajax({
type: "GET",
url: "chat/mini.php",
success: function(chat){
$('.chat-message').html(chat);
},
error: function(err) {
console.log(err);
}
});
我在chat/mini.php
链接中删除了
<a href="#" id="'.$row['id'].'" class="delbutton text-danger" title="Delete">X</a>
和脚本
$(".delbutton").click(function () {
//Save the link in a variable called element
var element = $(this);
//Find the id of the link that was clicked
var del_id = element.attr("id");
//Built a url to send
var info = 'id=' + del_id;
if (confirm("Sure you want to delete? There is NO undo!")) {
$.ajax({
type: "GET",
url: "chat/delete.php",
data: info,
success: function () {
}
});
}
return false;
});
当我没有加载与ajax
的聊天时这些鳕鱼工作,但是当我用ajax
加载这些时,这些不起作用。我必须加点工作吗?