日期:2014-05-16 浏览次数:20672 次
<form class="navbar-form navbar-right" role="form">
<div class="form-group">
<input type="text" id="phone" placeholder="请输入手机号" class="form-control" required>
</div>
<div class="form-group">
<input type="password" id="password" placeholder="请输入密码" class="form-control" required>
</div>
<button onclick="login()" class="btn btn-success">会员登录</button>
function login(){
alert("phone="+$("#phone").val()+"&password="+$("#password").val())
$.ajax({
type: "get",
url: "loginAjax.action",
data: "phone="+$("#phone").val()+"&password="+$("#password").val(),
success: function(json){
alert(json.loginmessage)
}
})
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="xpy" extends="json-default">
<global-results>
<result name="input">index.jsp</result>
</global-results>
<action name="*RoomType" class="com.sapphire.rujiahotel.action_1.RoomTypeAction" method="{1}">
<result name="success">/commclose.jsp</result>
<result name="tojsp">${whereto}</result>
</action>
<action name="*Room" class="com.sapphire.rujiahotel.action_1.RoomAction" method="{1}">
<result name="success">/commclose.jsp</result>
<result name="tojsp">${whereto}</result>
</action>
<action name="*Userinfo" class="com.sapphire.rujiahotel.action_1.UserinfoAction" method="{1}">
<result name="success">/commclose.jsp</result>
<result name="return" type="redirect">/home.jsp</result>
</action>
<action name="*Ajax" class="com.sapphire.rujiahotel.action_1.AjaxAction" method="{1}">
<result type="json"></result>
</action>
</package>
</struts>