<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/inc/base.jsp"%>
<!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>userLoginPage</title>
<script src="http://malsup.github.io/jquery.form.js"></script>
<script type="text/javascript">
$(function() {
$('#p').panel({
width : 270,
height : 150,
title : '登录界面',
});
$("#loginbtn").click(function() {
$("#loginf").submit(function() {
alert("111");
$(this).ajaxSubmit({
type: 'post', // 提交方式 get/post
url: '${ctx}/userLogin-default/handleLogin', // 需要提交的 url
data: $('#loginf').serialize(),
success: function(data) { // data 保存提交后返回的数据,一般为 json 数据
// 此处可对 data 作相关处理
alert('提交成功!');
}
//$(this).resetForm(); // 提交后重置表单
});
return false; // 阻止表单自动提交事件
});
});
});
</script>
</head>
<body>
<div id="p" style="padding: 10px;">
<form id="loginf" method="post" >
<table style="font-family: '微软雅黑', '楷体';">
<tr>
<td>用户名</td>
<td><input type="text" name="userName" value="" /></td>
</tr>
<tr>
<td>密码</td>
<td><input type="password" name="userPass" value="" /></td>
</tr>
<tr>
<td colspan="2"><button id="loginbtn" <span style="color:#ff0000;">class="easyui-linkbutton"</span>
class="">登录</button></td>
</tr>
</table>
</form>
</div>
</body>
</html>
以上代码会报错,easyui 属性值冲突 ,导致form表单无法提交[$("#loginf").submit()失效] ,删掉上面button里面的class属性即可
另外,不能使用a标签进行提交,同样也会导致失效问题的出现