This is json.html function_GetData () {varsid $ (& quot; # sid & quot;). val (); jQ to get the user input value $. ajax ({php asynchronous jquery
This is json.html
Function _ GetData ()
{
Var sid = $ ("# sid"). val (); // jQ gets the value entered by the user
$. Ajax (
{
Type: "POST ",
Url: "json. php ",
Data: {"stu_id": sid },
Cache: false,
DataType: "json ",
Success: function (msn)
{
Var content ="
| Id |
Name |
Professional |
Phone Number |
Student ID |
";$. Each (msn, function (I){Content + ="
| "+ Msn [I] [0] +" |
"+ Msn [I] [1] +" |
"+ Msn [I] [2] +" |
"+ Msn [I] [3] +" |
"+ Msn [I] [4] +" |
";});Content + ="
";
$ ("# Test" contents .html (content );
}
});
}
This is json. php
$ Sid = $ _ POST ["sid"];
Include 'comm. php'; // connect to the database
$ SQL = "select * from stu where stu_id = {$ sid }";
$ Result = mysql_query ($ SQL );
While ($ row = mysql_fetch_array ($ result )){
$ Arr [] = $ row;
}
Echo json_encode ($ arr );
The input data cannot be uploaded to the php page through ajax!