Skip to content

Instantly share code, notes, and snippets.

@DapperFox
Created August 22, 2014 03:44
Show Gist options
  • Save DapperFox/00e8b0f3ef86faf2fa89 to your computer and use it in GitHub Desktop.
Save DapperFox/00e8b0f3ef86faf2fa89 to your computer and use it in GitHub Desktop.
ajax no worky
'use strict';
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
$(document).ready(function() {
$('#register').submit(function(evt) {
var $regVals = $('#register').serializeArray();
if(!validateEmail($regVals[1].value)) {
evt.preventDefault();
$('.message').html('<p>Must be a valid email address</p>').show(300).delay(3000).hide(300);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment