If the request parameter is formdata, use the Ajax operation

If the request parameter supplied when requesting the interface is of type FormData, we can divide the operation into two ways.
The method in FormData()
0, append() append value
1, set() modify value
2, getAll() get all check box values
3, get() get radio box values
1. Ajax encapsulated by jQuery
If the request parameter is formdata, must set two configuration items
processData: false
contentType: false

  $.ajax({
            url: 'Interface Address',
            type: "POST",
            data: fd,
            success: function(res){

            },
            processData: false, //do not convert data request data (the object format is automatically converted to string format on request)
            contentType: false // do not set request header (FormData comes with request header)
        })

2. Native Ajax manipulation
If the request parameter is FormData, then post-style Ajax requests no longer need to set the request header


FormData:
	var form = $("form")[0];	//Converting jq objects to DOM objects (must be DOM objects)
	var fd = new FormData(form);
	
	
Native ajax:
 		var xhr = new XMLHttpRequest();
        xhr.open('POST', '/common/post'). xhr.onload = function () { var xhr.open('POST', '/common/post');
        xhr.open('POST', '/common/post'); xhr.onload = function () {
            console.log(this.response); // output the result
        }
        xhr.send(fd); //pass the data from the form to the backend

Read More: