POST

$(function () {/ / request data (object) | array const param = {name: "li", the age: 20}; $. Ajax ({type: "POST", // contentType: "application/json; Charset = utf-8 ", / / request parameters media type url: "http://localhost:8080/xxx/xxx/", / / request address data: JSON. Stringify (param), // Request data dataType: "JSON ", // Request received data format success: function(result) {// Succeed, Perform business operation here}, error: Function (e){// fail to perform a business operation here, // or tell the user an error message}}); });

GET

$(function () {$. Ajax ({type: "GET", / / request url: "http://localhost:8080/xxx/xxx? Name =likui&age=20", // Request address dataType: "json", // Request received data format success: function(result) {// Succeed, execute business operation here}, error: Function (e){// fail to perform a business operation here, // or tell the user an error message}}); });