how to do file upload using jquery serialization

前端 未结 8 1551
感动是毒
感动是毒 2020-11-22 16:28

So I have a form and I\'m submitting the form through ajax using jquery serialization function

        serialized = $(Forms).serialize();

        $.ajax({
         


        
8条回答
  •  再見小時候
    2020-11-22 17:21

       var form = $('#job-request-form')[0];
            var formData = new FormData(form);
            event.preventDefault();
            $.ajax({
                url: "/send_resume/", // the endpoint
                type: "POST", // http method
                processData: false,
                contentType: false,
                data: formData,
    

    It worked for me! just set processData and contentType False.

提交回复
热议问题