
<!DOCTYPE html PUBLIC "‐//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http‐equiv="Content‐Type" content="text/html; charset=UTF‐8">
<title>Insert title here</title>
<script type="text/javascript" src="jquery‐3.3.1.js"></script>
<script type="text/javascript">
function sendRequest(){
$.ajax({
//url
url:"/AjaxDemo/ajaxServlet",
//true异步,false同步
async:true,
//发送到服务器端的数据
data:"name=haohao&age=33",
//请求方式
type:"GET",
//返回的数据类型
dataType:"text",
//成功回掉函数
success:function(data){
alert(data);
},
//失败回调函数
error:function(){
alert("数据没有成功返回!")
}
});
}
</script>
</head>
<body>
<input type="button" value="ajax异步访问服务端" onclick="sendRequest()">
</body>
</html>
2019-04-26
再完美的程序都会存在漏洞!
——深海藏有溺亡之鱼