JSFiddle - React, Tailwind, and code Playground
by Samyoul
JavaScript
var $display = $( '#textLog');
var $submitBtn = $( '#submitDataBtn' );
$( document ).ready(function(){
$submitBtn.click(function(){
$display.append('<img id="loader" src="images/loader.gif">');
$.post("ajaxer.php?action=xLogin",
{
email : $( '#email' ).val(),
Password_In : $( '#Password_In' ).val(),
ip : $( '#ip').val()
},
function( data ){
var $response = jQuery.parseJSON(data);
switch($response.response)
{
case "TRUE":
loginUser($display);
break;
case "not_authorised";
alertNotAuthed($display);
break;
case "email_not_confirmed";
alertEmailNotConfirmed($display);
break;
case "FALSE":
case "no_detail_match":
alertFail($display);
break;
}
$( '#loader' ).remove();
$display.text(data);
}
);
});
});
function loginUser($display){
$( '#alertMessage' ).remove();
$display.append("<div id="alertMessage" class="alert alert-success"><strong>Success!</strong> Your details match, we're logging you in now.</div>");
}
function alertNotAuthed($display){
$( '#alertMessage' ).remove();
$display.append("<div id="alertMessage" class="alert alert-danger"><strong>Warning!</strong> Thank you for trying to log in, unfortunately your account isn't yet authorised.</div>");
}
function alertEmailNotConfirmed($display){
$( '#alertMessage' ).remove();
$display.append("<div id="alertMessage" class="alert alert-danger"><strong>Warning!</strong> Thank you for trying to log in, unfortunately your email address hasn't bee...