Merged tiwariav/task/3657/contact_section into task/3740/contact_send_message

This commit is contained in:
PCoder 2017-08-27 13:19:05 +05:30
commit 28bcef082c
12 changed files with 362 additions and 79 deletions

View file

@ -39,7 +39,7 @@
_initScroll();
_initNavUrl();
_initPricing();
ajaxForms();
});
$(window).resize(function() {
@ -157,4 +157,27 @@
$('#valueTotal').text(numbers * price * 31);
}
})(jQuery);
function ajaxForms() {
$('body').on('submit', '.ajax-form', function(e){
e.preventDefault();
var $form = $(this);
$form.find('[type=submit]').addClass('sending');
$.ajax({
url: $form.attr('action'),
type: $form.attr('method'),
data: $form.serialize(),
success: function(response) {
var responseContain = $($form.attr('data-response'));
responseContain.html(response);
$form.find('[type=submit]').removeClass('sending');
},
error: function() {
$form.find('[type=submit]').removeClass('sending');
$form.find('.form-error').removeClass('hide');
}
});
})
}
})(jQuery);