如题所述
用户名:
<input type="text" name="name" id="name" /><br />
密码:<input type="password" name="pwd" id="pwd" /><br />
<input id='sub' type="button" value="确定" onclick="check()"/><br />
<label id="msg"></label>
<script type="text/javascript">
function check() {
var name = $.trim($('#name').attr('value'));
var pwd = $.trim($('#pwd').attr('value'));
if ("" == name || "" == pwd) {
alert('用户名或者密码不能为空');
} else {
$.ajax({
type : 'post',
url : 'login?name=' + name + '&pwd=' + pwd,
success : function(msg) {
if('success'==msg){
location.href='<%=basePath%>admin/masterhome.jsp' ;
}else{
$('#msg').html(msg);
}
}
});
}
}
</script>
<input type="text" name="name" id="name" /><br />
密码:<input type="password" name="pwd" id="pwd" /><br />
<input id='sub' type="button" value="确定" onclick="check()"/><br />
<label id="msg"></label>
<script type="text/javascript">
function check() {
var name = $.trim($('#name').attr('value'));
var pwd = $.trim($('#pwd').attr('value'));
if ("" == name || "" == pwd) {
alert('用户名或者密码不能为空');
} else {
$.ajax({
type : 'post',
url : 'login?name=' + name + '&pwd=' + pwd,
success : function(msg) {
if('success'==msg){
location.href='<%=basePath%>admin/masterhome.jsp' ;
}else{
$('#msg').html(msg);
}
}
});
}
}
</script>
温馨提示:答案为网友推荐,仅供参考