麻烦各位学霸能帮我看看吗,为啥我点击这个按钮他没有访问url
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
<title>Ajax</title>
<script src="/js/jquery-1.12.3.min.js" type="text/javascript"/>
<script>
//页面加载
$(function () {
//点击事件
$("#btn").click(function () {
$.ajax({
type:"post",
url:"/user/save5.do",
contentType:"application/json;charset=utf-8",
//json类型的数据k-v
data:'{"username":"jack","age":"20"}',
dataType:"json",
success:function (data) {
alert(data.username+"--"+data.age);
}
});
});
});
</script>
</head>
<body>
<input type="button" value="ajax" id="btn" >
</body>
</html>
//我点击按钮好像根本没走上面的function一样,url是对的,哪里出问题了麻烦帮我指出来哈,谢谢