So this function works perfectly exceptI have six more buttons and do not want my code to have a ton of repeat code. For the customizing part I would like for each callback to be different for example the text append "Please Log In" to be different if the user is not admin and etc. How I can I make this customizable for each button? Thank You!
error: (xhr, ajaxOptions, thrownError) ->
console.dir arguments
console.log("*| Status ", xhr.status)
console.log("*| Error", thrownError)
console.log("*| Ajax", ajaxOptions)
if (not username? or not password?)
$('#data-text').empty()
$('#data-text').append ("""<h1>Please Log In</h1>""")
$('#input_username').fadeTo(100, 0.1).fadeTo(200, 1.0);
$('#input_password').fadeTo(100, 0.1).fadeTo(200, 1.0);
$('#header_user').css "background-color": "#d34242"
$('#header_password').css "background-color": "#d34242"
$('#data-text').css "background-color": "#d38642"
else
$('#data-text').empty()
$('#data-text').append ("""<h1>Failed Log In</h1>""")
$('#input_username').fadeTo(100, 0.1).fadeTo(200, 1.0);
$('#input_password').fadeTo(100, 0.1).fadeTo(200, 1.0);
$('#header_user').css "background-color": "#d34242"
$('#header_password').css "background-color": "#d34242"
$('#data-text').css "background-color": "#d38642"
PLEASE Keep code in CoffeeScript