<!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

                                                              再完美的程序都会存在漏洞!

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

                                                                     ——深海藏有溺亡之鱼

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄