Skip to content

Instantly share code, notes, and snippets.

@kmarenov
Created July 17, 2017 12:02
Show Gist options
  • Select an option

  • Save kmarenov/8aed0bee5a65514b6dbb6c72ab4c5ef0 to your computer and use it in GitHub Desktop.

Select an option

Save kmarenov/8aed0bee5a65514b6dbb6c72ab4c5ef0 to your computer and use it in GitHub Desktop.
$(document.body).on('submit', 'form.valuation-request-form', function (event) {
event.preventDefault();
var title = 'Заявка принята';
var message = 'Мы свяжемся с вами в ближайшее время';
var modal = $('#md-after-subscribe');
var form = $(this);
$.ajax({
type: 'POST',
url: Routing.generate('api_app_form_valuation_request'),
data: new FormData(form[0]),
processData: false,
contentType: false
})
.done(function (data) {
if (data.errors) {
title = 'Ошибка';
message = data.errors;
} else {
$('form.valuation-request-form input[type="text"]').val('');
$('form.valuation-request-form textarea').val('');
$('#files').html('');
}
modal.find('h2').text(title);
modal.find('p').text(message);
hidePopup();
modal.fadeIn();
$('body').addClass('popup-shows');
$('.custom-scroll').jScrollPane();
modal.find('.custom-scroll').jScrollPane();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment