HTML forms can send an HTTP request declaratively. But forms can also prepare an HTTP request to send via JavaScript, for example via XMLHttpRequest. This article explores such approaches.
With progressive web apps, single page apps, and framework based apps, it’s common to use HTML forms to send data without loading a new document when response data is received.
1.Building an XMLHttpRequest manually.
2.Using a standalone FormData object.
3.Using FormData bound to a <form> element.
If you use a FormData object with a form that includes widgets, the data will be processed automatically. But to send binary data by hand, there’s extra work to do.