Created
April 12, 2018 06:45
-
-
Save nathan5x-zz/12942c1f28c8ff0cda5ad99057f429b0 to your computer and use it in GitHub Desktop.
Create UI Component in HTML, CSS, and JS like it is in Adobe Flex & ActionScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var LoginAdapter = { | |
loginServiceURL : 'api.yoursite.com/login', | |
loginHTTPMethodType : 'POST', | |
login : function (instance) { | |
var loginData = instance.loginData; | |
/* Client Side Processing for demonstration*/ | |
if(loginData.username === 'user' && loginData.password === 'pwd') { | |
$('#status').text(instance.name +": Succeeded"); | |
} else { | |
$('#status').text(instance.name +": Failed"); | |
} | |
/* //Server side processing | |
$.ajax({ | |
url : this.loginServiceURL, | |
type: this.loginHTTPMethodType, | |
data : loginData, | |
success:function(loginResponseData) | |
{ | |
console.log( loginResponseData.loginStatus ? 'succeeded' : 'failed' ); | |
}, | |
error: function(ajaxRequest, errorDetails) | |
{ | |
console.log('Some error has been occurred'); | |
} | |
}); */ | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment