FormData.entries()
The FormData.entries()
方法返回一个 iterator
对象,此对象可以遍历访问 FormData 中的键值对。其中键值对的 key 是一个 USVString
对象;value 是一个 USVString
, 或者 Blob
对象。
备注: 此方法在 Web Workers 可用。
语法
formData.entries();
返回值
返回 iterator
。
示例
// Create a test FormData object
var formData = new FormData();
formData.append('key1', 'value1');
formData.append('key2', 'value2');
// Display the key/value pairs
for(var pair of formData.entries()) {
console.log(pair[0]+ ', '+ pair[1]);
}
执行结果为:
key1, value1 key2, value2
规范
No specification found
No specification data found for api.FormData.entries
.
Check for problems with this page or contribute a missing spec_url
to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.
浏览器兼容
BCD tables only load in the browser