<script SRC="https://bbs.csdn.net/topics/js/jquery-3.1.1.min.js" & gt; </script>
<script>
Window. The onl oad=function () {
$. Ajax ({
Url: "json/student. Json,"
Type: "GET",
DataType: "json",
Success: the function (data) {
$(" # name "). The HTML (data. Name);
$(" # age "). The HTML (data) age);
$(" # birthday "). The HTML (data. Date of birth)
$(" # isLeagueMember "). The HTML (data. Whether the member);
$(" # school "). The HTML () data. The school;
$(" # hobby "). The HTML (data. Hobby);
},
Error: function () {
Alert (" error ");
}
})
}
</script>
Part of HTML
Name & lt;/td> | |
Age & lt;/td> | |
Date of birth & lt;/td> | |
Whether the party member & lt;/td> | |
In colleges and universities & lt;/td> | |
Hobbies & lt;/td> |
json part
{
"Name" : "ABC",
"Age" : 20,
"Date of birth" : "2000-1-1",
"Whether member" : true,
"School", "ABC",
"Hobby" : [" basketball ", "cartoon", "travel"]
}
CodePudding user response:
Check your tomcat port is occupied, did not lead to the servers