-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
63 lines (48 loc) · 1.65 KB
/
main.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// http://stackoverflow.com/questions/28546969/cors-authorization-on-google-sheets-api-requests/29152936#29152936
window.googleDocCallback = function () { return true; };
$('document').ready(function(){
$('#form').validate({
rules:{
"entry.1673767957":{
required:true,
maxlength:40
},
"entry.522036821":{
required:true,
email:true,
maxlength:100
},
"entry.1025000276":{
required:true
}},
messages:{
"name":{
required:"This field is required"
},
"email":{
required:"This field is required",
email:"Please enter a valid email address"
},
"message":{
required:"This field is required"
}},
submitHandler: function(form){
// cross origin problem cause success callback not execute, so implement the same function in both callbacks
$(form).ajaxSubmit({
target: '#preview',
success: emptyFieldsAndShowMessage,
error: emptyFieldsAndShowMessage
});
}
});
});
function emptyFieldsAndShowMessage() {
// mensaje de exito
// $('.form-messages').html('success!!!!');
swal('Good job!', 'You clicked the button!', 'success');
var formQueryParams = $(form).serialize();
window.location.href = 'http://localhost/dranavarrete/contacto/exito?' + formQueryParams;
// $('#entry_1673767957').val('');
// $('#entry_522036821').val('');
// $('#entry_1025000276').val('');
}