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

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

代码示例1
$("#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);
        }           
    });
}));