Formdata is a new interface added by XMLHttpRequest Level 2, using the Formdata object, we can use JavaScript to simulate a series of form controls with some key-value pairs, as well as using XMLHttpRequest's Send ( ) method to commit the "form" asynchronously. The biggest advantage of using formdata compared to normal Ajax is that we can upload a binary file asynchronously.
Mainstream mobile phone system is basically webkit core, can be used.
var form= new FormData (optional htmlformelement from);//can accept one-piece form element note
You can enter Console.dir (form) in the Google console panel to see how the form looks:
1, append (): Add data for key-value pairs.
2. Delete (): Deletes the data to be deleted based on the key value name.
3, Entries (): Traversal of key-value pairs, ES2016 syntax, usage: Form.entries.next () returns a key-value pair of a map data structure, directly returning a iterator object with Form.entries ().
4. ForEach (): Use the callback function to traverse each member.
5, Get (): Get value by key value
6, GetAll ():
7, has (): The key value to determine whether to use the data
8. Keys (): The iterator that returns the key name
9. Set (): Set new value
10. VALUES (): Iterator of the return value of the Walker
Form.append (Key,value);//Add key value pair data if a form has been passed in, the Name property of the HTML is key such as <imput name= "user" > key value pair is the value of name "user"
Form.get ("user"), or//based on the name attribute of the HTML, also known as key to obtain
HTML5 FormData Simulation Form control supports asynchronous upload of binary files on the mobile side