Actually, Formdata is an object.
He is a relatively new thing (in fact, I do not know what to change the name of the good)
Using an FormData
object, you can use a series of key-value pairs to simulate a complete form and then use the XMLHttpRequest
"form" to send it.
Let me tell you about his usage:
First we're going to new a Formdate object,
For example: var date = new Formdate ();
In fact, I looked at the first glance, I thought it was JQ, because I saw a append haha, we can understand Xx.append (key,val), append there are 2 parameters.
For example: Data.append ("name", "Ye Ye");
We save more data so that we can upload the form using post in Ajax.
var XHR = new XMLHttpRequest ();
XHR = open ("POST", "address");
Xhr.send (date);
Ok!!!! Isn't it simple!
So what if we have more data, and we don't append in?
No! NONO ...
if: $scope. Params is an object that stores an object with a lot of data (key,val) in it, so
var data = new FormData ();
for (var i in $scope. Params) {
Data.append (i, $scope. Params[i]);
}
Isn't it simple again!
This data object, you can send to the backstage.
Formdata general usage, mobile, PC-side can be used, PC has compatibility issues