Skip to content

Instantly share code, notes, and snippets.

@lidaling
Created May 6, 2014 02:40
Show Gist options
  • Save lidaling/11552268 to your computer and use it in GitHub Desktop.
Save lidaling/11552268 to your computer and use it in GitHub Desktop.
js section
var Login={};
Login=(function(){
var LOGIN_URL="/user/account/login";
return{
init:function(){
},
bindEvents:function(){
$(".login-bt").click(function(){
var loginName=$(".loginName").val();
var passwd=$(".passwd").val();
var captcha=$('.captcha').val();
Login.login(loginName,passwd,captcha);
});
},
login:function(loginName,passwd,captcha){
$.ajax({
url : LOGIN_URL,
type : "POST",
data : {loginName:loginName,passwd:passwd,captcha:captcha},
success : function(data){
if(data.status&& data.status=='500'){
alert(data.exception);
}else{
afterLoginBlock();
}
},
dataType : "json"
});
}
}
function afterLoginBlock(){
$('#login').load('/user/account/afterLogin');
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment