0

Всем привет))

Озадачил меня фон Bootstrap для модального окна, окно при отправке пропадает, но фон остается и убирается только перезагрузкой страницы..... Зловредный $('.axalax-maxalay').modal("hide"); не работает....

Что может помочь?)

Форма развернута на сайте https://oreshkashop.ru/market/goods/izum_terma_bez_hvostikov/ в кнопке обратной связи.... Код отправки прилагаю:

$(function () {

 $('.btn-call').on('click', function (event) {
      // console.log("lolkrk")
      $('.callme-modal').fadeIn();

 });

 $('.callme-modal').on('click', function (event) {
      let target = event.target;
      target = target.closest('.callme-box')

      // console.log(target)
      if (!target) {
           $('.callme-modal').fadeOut();
      }
 });

 $('form').on('submit', function (event) {
      event.preventDefault();
      var data = $(this).serialize();
      $.ajax({
           url: $(this).action,
           type: 'POST',
           data: data,
           dataType: 'text json',
           success: function (result) {
                // var response = JSON.parse(result);
                console.log(result);
           }
      });

      return false;
 });

2 ответа 2

0

Добавь к конец callback $(".modal-backdrop").fadeOut();

$('form').on('submit', function (event) {
      event.preventDefault();
      var data = $(this).serialize();
      $.ajax({
           url: $(this).action,
           type: 'POST',
           data: data,
           dataType: 'text json',
           success: function (result) {
                // var response = JSON.parse(result);
                console.log(result);
                $(".modal-backdrop").fadeOut();
           }
      });

      return false;
 });
1
  • так же мне помогло добавление $('.close').click(); 24 дек 2019 в 10:05
0

Фон остается из-за классов modal-backdrop fade show. Я в бутстрап не силен, скорее всего предыдущий ответ поможет. Если нет, то в success надо прописать $(".modal-backdrop").remove(); либо $(".modal-backdrop").hide();

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.