Ajax calls the restful interface to transmit Json data, restfuljson
The key to transmitting data in json format through ajax is to specify the contentType. If data is in json format
For the restful interface, change the type to the corresponding post (ADD), delete (delete), put (change), and get (query ).
Var post_data = {"name": "test001", "pass": "xxxx" };$. ajax ({url: "http: // 192.168.10.111: 8080/uc/login", type: 'post', contentType: "application/json; charset = UTF-8", data: JSON. stringify (post_data), success: function (data) {// call successful}, error: function (data, textStatus, errorThrown) {// call failed }});
The above is a full description of the Ajax method used to call restful interfaces to transmit Json-format data. I hope it will be helpful to you, if you want to learn more, please stay tuned to the help House website!