javascript 为什么 FormData 是空的?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34154556/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 17:19:40 来源:igfitidea点击:
Why is FormData empty?
提问by shibly
I have followed this guide on MDN.
var formData = new FormData();
formData.append("username", "Groucho");
formData.append("accountnum", 123456);
console.log(formData);
Why is formData
empty?
为什么是formData
空的?
回答by Parth Trivedi
Their is way to access FormData
他们是访问 FormData 的方式
var formData = new FormData();
formData.append("username", "Groucho");
formData.append("accountnum", 123456);
console.log(formData.get("username"));
console.log(formData.get("accountnum"));