<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title>用户登录</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<script type="text/javascript"
src="../js/jquery-easyui-1.3.5/jquery.min.js"></script>
<script type="text/javascript"
src="../js/jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
<link rel="stylesheet"
href="../js/jquery-easyui-1.3.5/themes/default/easyui.css"
type="text/css"></link>
<link rel="stylesheet" href="../js/jquery-easyui-1.3.5/themes/icon.css"
type="text/css"></link>
<script type="text/javascript"
src="../js/jquery-easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" charset="UTF-8">
$(function() {
var regDialog;
var loginDialog;
loginDialog= $('#loginDialog').dialog({
closed: false,
modal : true, //模式化窗口
buttons:[{
text : '注册',
handler : function() {
regDialog.dialog('open');
}
},{
text : '登录',
handler : function() {
$.ajax({
type:'post',
url :'../servlet/Login_Do',
data:$('#loginForm').serialize(),
dataType:'json',
success:function(data){
console.info(data.msg);
if(data.msg){
loginDialog.dialog('close');
$.messager.show({
title:'My Title',
msg:'Message will be closed after 5 seconds.',
timeout:5000,
showType:'slide'
});
}else{
$.messager.alert('My Title','Here is a info message!','info');
}
},
error:function() {
alert("失败");
}
});
}
}]
});
});
</script>
</head>
<body style="width:100%;height:100%;">
<div id="loginDialog" title="用户登录" style="width:250px;height:220px;">
<form id="loginForm" method="post">
<table>
<tr>
<th>用户名:</th>
<td><input type="text" name="name"><br>
</td>
</tr>
<br>
<tr>
<th>密<span> </span>码:</th>
<td><input id="password" name="password" type="password" class="easyui-validatebox" data-options="required:true" /> <br>
</tr>
</table>
</form>
</div>
</body>
type:'post',的方式为post ,或者你在form表单制定url
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
<title>用户登录</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<script type="text/javascript"
src="../js/jquery-easyui-1.3.5/jquery.min.js"></script>
<script type="text/javascript"
src="../js/jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
<link rel="stylesheet"
href="../js/jquery-easyui-1.3.5/themes/default/easyui.css"
type="text/css"></link>
<link rel="stylesheet" href="../js/jquery-easyui-1.3.5/themes/icon.css"
type="text/css"></link>
<script type="text/javascript"
src="../js/jquery-easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" charset="UTF-8">
$(function() {
var regDialog;
var loginDialog;
loginDialog= $('#loginDialog').dialog({
closed: false,
modal : true, //模式化窗口
buttons:[{
text : '注册',
handler : function() {
regDialog.dialog('open');
}
},{
text : '登录',
handler : function() {
$.ajax({
type:'post',
url :'../servlet/Login_Do',
data:$('#loginForm').serialize(),
dataType:'json',
success:function(data){
console.info(data.msg);
if(data.msg){
loginDialog.dialog('close');
$.messager.show({
title:'My Title',
msg:'Message will be closed after 5 seconds.',
timeout:5000,
showType:'slide'
});
}else{
$.messager.alert('My Title','Here is a info message!','info');
}
},
error:function() {
alert("失败");
}
});
}
}]
});
});
</script>
</head>
<body style="width:100%;height:100%;">
<div id="loginDialog" title="用户登录" style="width:250px;height:220px;">
<form id="loginForm" method="post">
<table>
<tr>
<th>用户名:</th>
<td><input type="text" name="name"><br>
</td>
</tr>
<br>
<tr>
<th>密<span> </span>码:</th>
<td><input id="password" name="password" type="password" class="easyui-validatebox" data-options="required:true" /> <br>
</tr>
</table>
</form>
</div>
</body>
</html>
求助,
我明明在form表单指定了post方式,为什么请求的还是get呢
然而并没有什么用,需要制定$.ajax({
type:'post',的方式为post ,或者你在form表单制定url