Post formdata via XMLHttpRequest object in JS ? ( cross browser)

后端 未结 2 1442
借酒劲吻你
借酒劲吻你 2020-12-30 16:27

Im trying to post a form data in js :

I have this code :

var formData = new FormData();
  formData.append(\"username\", \"Groucho\");
  formData.ap         


        
2条回答
  •  忘掉有多难
    2020-12-30 16:50

    You didn't say which version of IE you're using. The formData object is not supported in IE9 or lower. XMLHTTPRequest2 (which contains the formData object) should be supported in IE10 (http://caniuse.com/xhr2)

    Cross-browser AJAX file upload is very hard to do right now. You could try building your own form header/boundaries in Javascript (see answer here: XMLHttpRequest POST multipart/form-data) but, personally, I don't believe it is worth the effort.

提交回复
热议问题