Request payload mode, two requests are initiated
Form data only initiates one request
To change an AJAX request to payload, set ContentType, find that the request parameter is not an object, and then convert the argument to a string.
The code is as follows:
$.ajax ({ type: ' POST ', URL: ' http://192.168.50.10:11081/api/v1/login ', contentType: ' application/ Json;charset=utf-8 ', //json,request Payload data:json.stringify ({ password:123456, Username: ' Hexia ' }), success:function (CB) { Console.log (CB); } })
Easter Egg ~
X-ratelimit-limit: Represents the request rate, which is the maximum number of requests in one minute
X-ratelimit-remaining: Indicates the number of requests remaining in a minute
When the number of times remaining is 0 o'clock, the request will report a 429 error, at which point the retry-after will have a value indicating how many seconds to wait before returning to normal.
jquery control request payload and form Data