|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/gwsolutions/ebook/js/ |
Upload File : |
(function ($) {
$(function() {
var contactForm = $( '#contact-form' );
// var loader = contactForm.find('.ajax-loader');
contactForm.submit(function()
{
if (contactForm.valid())
{
contactForm.find(".submit.btn").attr('value','Sending...');
// loader.css('display', 'block');
var formValues = $(this).serialize();
$.post($(this).attr('action'), formValues, function(data)
{
if ( data == 'success' )
{
contactForm.clearForm();
}
else
{
$('.alert').addClass('error');
}
// loader.hide();
contactForm.find(".submit.btn").attr('value','SEND');
$('.alert').fadeIn().delay(2000).fadeOut();
});
}
return false
});
});
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = '';
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
})(jQuery);