Convert JS Object to form data

前端 未结 18 1887
孤街浪徒
孤街浪徒 2020-11-29 17:22

How can I can convert my JS Object to FormData?

The reason why I want to do this is, I have an object that I constructed out of the ~100 form field valu

18条回答
  •  借酒劲吻你
    2020-11-29 17:47

    Try JSON.stringify function as below

    var postData = JSON.stringify(item);
    var formData = new FormData();
    formData.append("postData",postData );
    

提交回复
热议问题