- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
- 64
- 65
- 66
- 67
- 68
- 69
$('.send_message').click(function(e){
e.preventDefault();
var error = false;
var name = $('#contact_form_holder'+this.id).find('#name').val();
var email = $('#contact_form_holder'+this.id).find('#email').val();
var phone = $('#contact_form_holder'+this.id).find('#phone').val();
var subject = $('#contact_form_holder'+this.id).find('#subject').val();
var message = $('#contact_form_holder'+this.id).find('#message').val();
if(name.length == 0){
var error = true;
$('#contact_form_holder'+this.id).find(".name_field").addClass('error1');
}else{
$('#contact_form_holder'+this.id).find(".name_field").addClass('success');
}
if(email.length == 0 || email.indexOf('@') == '-1'){
var error = true;
$('#contact_form_holder'+this.id).find(".email_field").addClass('error1');
}else{
$('#contact_form_holder'+this.id).find(".email_field").addClass('success');
}
if(phone.length == 0){
var error = true;
$('#contact_form_holder'+this.id).find(".phone_field").addClass('error1');
}else{
$('#contact_form_holder'+this.id).find(".phone_field").addClass('success');
}
if(subject.length == 0){
var error = true;
$('#contact_form_holder'+this.id).find(".subject_field").addClass('error1');
}else{
$('#contact_form_holder'+this.id).find(".subject_field").addClass('success');
}
if(message.length == 0){
var error = true;
$('#contact_form_holder'+this.id).find(".message_field").addClass('error1');
}else{
$('#contact_form_holder'+this.id).find(".message_field").addClass('success');
}
if(error == false){
$('#contact_form_holder'+this.id).find('.send_message').attr({'disabled' : 'true', 'value' : 'Sending...' });
$formVar = this.id;
$.post('send_email.php', $('#contact_form_holder'+$formVar).find('#contact_form').serialize(),function(result){
if(result == 'sent'){
$('#contact_form_holder'+$formVar).find(".cf_submit_p").remove();
$('#contact_form_holder'+$formVar).find('#mail_success').fadeIn(500);
}else{
$('#contact_form_holder'+$formVar).find('#mail_fail').fadeIn(500);
$('#contact_form_holder'+$formVar).find('.send_message').removeAttr('disabled').attr('value', 'Send The Message');
}
});
if(error == false){
$('#send_message').attr({'disabled' : 'true', 'value' : 'Sending...' });
$.post("send_email.php", $("#contact_form").serialize(),function(result){
if(result == 'sent'){
$('#cf_submit_p').remove();
$('#mail_success').fadeIn(500);
}else{
$('#mail_fail').fadeIn(500);
$('#send_message').removeAttr('disabled').attr('value', 'Send The Message');
}
});
}
}
});
});