We know that it is best to specify the application/x-www-form-urlencoded encoding type by setting the request header when sending AJAX requests to the server via post. You must specify that the encoding type is "Multipart/form-data" when uploading a file through a form. And Text/plain is set when we are doing plain text transmission to prevent coding clutter when we receive data. But I haven't figured out why I'm setting this up. Later looked up some information to find the difference between the three.
application/x-www-form-urlencoded
This is the default encoding type when sending data through a form. We did not set the Enctype property in the from tag by default, which is the application/x-www-form-urlencoded type. The application/x-www-form-urlencoded encoding type encodes the data sent in the form into a name/value pair. This is the standard encoding format. When the action of the form is post, the browser encapsulates the form data into the HTTP body and sends it to the server. When the form's action is get, the application/x-www-form-urlencoded encoding type converts the data sent in the form into a string (name=coderbolg&key=php). Then append the string to the URL, split it, and then request the new URL. When we send AJAX requests to the server via post, it is best to specify the application/x-www-form-urlencoded encoding type by setting the request header. Method is added after the Xmlobject.open () method
Xmlobject . setRequestHeader ("Content-type","application/x-www-form-urlencoded")
Otherwise the server will not receive the post data.
Multipart/form-data
This is specifically used to transmit special types of data, such as the content of non-text we upload, than tablets or MP3. The Multipart/form-data encoding type encodes the data sent in the form into a single message, which is part of the message for each form control on the page. When the form has a file type control and wants it to work (nonsense) it must be set to the Multipart/form-data type, the browser splits the entire form in controls and adds content-disposition to each section ( Form-data or file), Content-type (default is Text/plain), name (control name) and so on, plus a separator (boundary).
Text/plain
The data is encoded in plain text, with no controls or formatting characters. There's nothing to say.