Fix: typos

This commit is contained in:
kvoncode 2019-11-19 20:49:32 +09:00 committed by GitHub
parent 79417c6e73
commit 0152adcc0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,14 +54,14 @@ In this example, the server code is not presented, as it's beyound our scope. Th
We can modify fields in `FormData` with methods:
- `formData.append(name, value)` - add a form field with the given `name` and `value`,
- `formData.append(name, blob, fileName)` - add a field as if it were `<input type="file">`, the third argument `fileName` sets file name (not form field name), as it it were a name of the file in user's filesystem,
- `formData.append(name, blob, fileName)` - add a field as if it were `<input type="file">`, the third argument `fileName` sets file name (not form field name), as it were a name of the file in user's filesystem,
- `formData.delete(name)` - remove the field with the given `name`,
- `formData.get(name)` - get the value of the field with the given `name`,
- `formData.has(name)` - if there exists a field with the given `name`, returns `true`, otherwise `false`
A form is technically allowed to have many fields with the same `name`, so multiple calls to `append` add more same-named fields.
There's also method `set`, with the same syntax as `append`. The difference is that `.set` removes all fields with the given `name`, and then appends a new field. So it makes sure there's only field with such `name`, the rest is just like `append`:
There's also method `set`, with the same syntax as `append`. The difference is that `.set` removes all fields with the given `name`, and then appends a new field. So it makes sure there's only one field with such `name`, the rest is just like `append`:
- `formData.set(name, value)`,
- `formData.set(name, blob, fileName)`.