FormData.entries()
The FormData.entries()
方法返回一个 iterator
对象 ,此对象可以遍历访问FormData中的键值对。其中键值对的key是一个 USVString
对象;value是一个 USVString
, 或者 Blob
对象。
Note: 此方法在 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
规范
规范 | 状态 | 备注 |
---|---|---|
XMLHttpRequest entries() (as iterator<>) |
Living Standard | Initial definition |
浏览器兼容
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 50.0 | 44 (44) | ? | ? | ? |
Available in web workers | 50.0 |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | 未实现 | 50.0 | 44.0 (44) | (Yes) | ? | ? | ? | 50.0 |
Available in web workers | 未实现 | 50.0 | 50.0 |