: This article mainly introduces simple json interaction examples between php and html. For more information about PHP tutorials, see.
Front-end (HTML) code
Simple example of foreground processing json
$ ("Document "). ready (function () {var url = "server2.php"; var data = {"do": "first"}; $. getJSON (url, data, function (res) {$ ("# username "). val (res. username); $ ("# password "). val (res. password) ;}); var data = {"do": "second" };$. getJSON (url, data, function (res) {$ ("# members "). val (res [2]. username );});});
Get user name and password
User name:
Password:
Obtain member information
Background (PHP) code
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above describes the simple json interaction examples between php and html, including some content, and hope to be helpful to friends who are interested in PHP tutorials.