📜  ajax 上传图片 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:09.541000             🧑  作者: Mango

代码示例2
$("#changeProfilePicForm").submit(function (e) {
    e.preventDefault();
    var $form = $(this);
    $.ajax({
        url: $form.attr('action'),
        type: "POST",
        data:  new FormData($form[0]),
        contentType: false,
        cache: false,
        processData: false,
        success: function (data) {
            console.log(data);
        },
        error: function(data){
            console.log(data);
        }           
    });
}));