ajax request without data not working

前端 未结 1 992
谎友^
谎友^ 2021-01-28 03:28

I am trying to delete a photo using ajax and when the photo is deleted show default image instantly, so far I am done with php side but the ajax part isn\'t working. How can I m

相关标签:
1条回答
  • 2021-01-28 04:18

    Try move "page= delete" in data secction:

    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'}
            });
    
        }
    
    0 讨论(0)
提交回复
热议问题