-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
38 lines (35 loc) · 1.01 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
$( document ).ready(function() {
$("#submit").click(function(){
var sEmail = $('#fname').val();
if (validateEmail(sEmail)) {
console.log("10");
ajaxInsert(sEmail);
$(".second_col").hide();
$(".second_col_thankyou").show();
}else {
console.log("100");
$(".error-msg").html("Please enter a valid email address");
// setTimeout(function() {
// $(".error-msg").hide()
// }, 5000);
}
});
function validateEmail(sEmail) {
var filter = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
if (filter.test(sEmail)) {
return true;
}
}
function ajaxInsert(sEmail){
$.ajax({
url : 'controller.php',
type : 'POST',
data : {
'sEmail' : sEmail
},
dataType:'json',
success : function(data) {
}
});
}
});