jquery $ 未定义
jquery文件引入了,是在最上面引入的。一直报错
<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加</title>
<script type="text/javascript" src="../js/jquery-min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
alert(22);
});
function deleteStaff(){
alert("11");
$.ajax({
type : "POST",
url : "/test/json.do",
dataType : "json",
success : function(data) {
if (data.result == "success") {
alert("測試成功!");
}else{
alert("測試失敗!");
}
},
error : function() {
alert("网络连接出错!");
}
});
}
</script>
</head>
<body>
<div>
<form action="test/add.do?parameters=123" id="addStaffForm" name="addStaffForm" method="post">
<input type="button" onclick="javascript:deleteStaff()" value="測試json"></input>
</form>
</div>
</body>
</html>