Skip to content

Instantly share code, notes, and snippets.

@nathan5x-zz
Created April 12, 2018 06:45
Show Gist options
  • Save nathan5x-zz/12942c1f28c8ff0cda5ad99057f429b0 to your computer and use it in GitHub Desktop.
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
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