var password = document.getElementById("password")
, confirm_password = document.getElementById("confirmPassword");
document.getElementById('signupLogo').src = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSJZhNXJlPcwySsmDH7SnjadPo9eN5gDnsG0tqeL4vvUw&s";
enableSubmitButton();
function validatePassword() {
if(password.value != confirm_password.value) {
confirm_password.setCustomValidity("Passwords Don't Match");
return false;
} else {
confirm_password.setCustomValidity('');
return true;
}
}
password.onchange = validatePassword;
confirm_password.onkeyup = validatePassword;
function enableSubmitButton() {
document.getElementById('submitButton').disabled = false;
document.getElementById('loader').style.display = 'none';
}
function disableSubmitButton() {
document.getElementById('submitButton').disabled = true;
document.getElementById('loader').style.display = 'unset';
}
function validateSignupForm() {
var form = document.getElementById('signupForm');
for(var i=0; i < form.elements.length; i++){
if(form.elements[i].value === '' && form.elements[i].hasAttribute('required')){
console.log('There are some required fields!');
return false;
}
}
if (!validatePassword()) {
return false;
}
onSignup();
}
function onSignup() {
var xhttp = new XMLHttpRequest();
xhttp. {
disableSubmitButton();
if (this.readyState == 4 && this.status == 200) {
enableSubmitButton();
}
else {
console.log('AJAX call failed!');
setTimeout(function(){
enableSubmitButton();
}, 1000);
}
};
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}