我正在尝试使用ajax删除照片,当删除照片时立即显示默认图像,到目前为止,我完成了php端,但ajax部分无法正常工作。如何在没有数据类型的情况下发出ajax请求?
function delete_image()
{
$.ajax({
type: "POST",
url: "target.php?page=delete",
cache: false,
success: function(response)
{
var $divs = $("<div>" + response + "</div>");
$("#phd").fadeOut('slow');
$(".suc_pic").fadeIn('slow').empty().append($divs.find("#msg"));//the default picture fades in once the photo is deleted.
}
});
}
答案 0 :(得分:-1)
尝试在数据部分中移动“page = delete”:
function delete_image()
{
$.ajax({
type: "POST",
url: "target.php",
cache: false,
success: function(response)
{
var $divs = $("<div>" + response + "</div>");
$("#phd").fadeOut('slow');
$(".suc_pic").fadeIn('slow').empty().append($divs.find("#msg"));//the default picture fades in once the photo is deleted.
},
data: {page='delete'}
});
}