easyui 3 post ajax

<%@ 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>&nbsp;&nbsp;</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




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值