Uploading file with jQuery Ajax

前端 未结 1 1790
心在旅途
心在旅途 2020-12-16 04:03

I have made many search on how to upload files from a form with Ajax, and found out that xhr2 should be able to do it. Yet, I have tried myself to use FormData objects and i

相关标签:
1条回答
  • 2020-12-16 04:20

    Try to replace the code:

    data = new FormData($('#form'));
    

    with this:

    data = new FormData($('#form')[0]);
    

    to get the first DOM element from the jQuery array.

    0 讨论(0)
提交回复
热议问题