jQuery 参考手册 - Ajaxhttps://www.w3school.com.cn/jquery/jquery_ref_ajax.asp
Jquery CDN
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
举个例子
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
</script>
<body>
<div id="myDiv"><h2>内容</h2></div>
<button type="button" onclick="loadXMLDoc()">登录</button>
</body>
<script>
function loadXMLDoc(){
$.ajax({
"url":"http://localhost:8080/admin/index", //要提交的URL路径
"type":"GET", //发送请求的方式
"data":{"age=": 19}, //要发送到服务器的数据
"dataType":"text", //指定返回的数据格式
"success":function (data){
document.getElementById("myDiv").innerHTML=data;
}, //响应成功后要执行的代码
"error":function(){ //请求失败后要执行的代码
alert("用户名验证时出现错误,请稍后再试");
},
});
}
</script>
</html>