jquery control request payload and form Data

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.