Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($.trim(email).length>0 && $.trim(password).length>0) {
- $.ajax({
- type: "POST",
- url: "http://www.example.com/app/login.php",
- crossDomain: true,
- dataType: 'json',
- data: $.trim(frm.serialize()),
- beforeSend: function(){
- $('#loader').css({ display: "block" });
- },
- success: function(data,status,XHR) {
- handleData(data);//handle the servers respond
- },
- error: function(httpReq,status,exception){
- alert("Network error: "+status+" "+exception);
- $('#loader').css({ display: "none" });
- }
- });
- }
- function handleData( responseData ) {
- var access = responseData;
- if(access == "good"){//server respond good username/pass
- alert("Welcome");
- $('#loader').css({ display: "none" });
- }
- }
- else{
- alert("Your username and password didn't match.");
- $('#input_password').val('');
- $('#loader').css({ display: "none" });
- }
- console.log(responseData);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement