


How Ajax calls restful interface to transmit Json format data (with code)
May 23, 2018 pm 04:24 PMThis article mainly introduces the relevant information on the method of Ajax calling restful interface to transmit Json format data. It is very good and has reference value. Interested friends should take a look at it.
ajax transmits json format data , the key is to specify the contentType. If the data is in json format
If it is a restful interface, change the type to the corresponding post (add), delete (delete), put (change), get (check)
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) { //调用成功 }, error: function(data, textStatus, errorThrown){ //调用失败 } });
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Ajax and cgi communication under Boa server (graphic tutorial)
Ajax Struts2 implementation verification Code verification function (graphic tutorial)
Ajax click to continuously load the data list (graphic tutorial)
The above is the detailed content of How Ajax calls restful interface to transmit Json format data (with code). For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to solve the 403 error encountered by jQuery AJAX request

How to solve jQuery AJAX request 403 error

How to get variables from PHP method using Ajax?

PHP vs. Ajax: Solutions for creating dynamically loaded content

How to solve the problem of jQuery AJAX error 403?

Understanding Ajax Frameworks: Explore Five Common Frameworks

Asynchronous data exchange using Ajax functions

PHP and Ajax: Ways to Improve Ajax Security
