1

В окне magnificPopup через AJAX мне необходимо передать переменную, исходя из документации и поиска по интернету достиг следующего кода:

$('.link_popup').magnificPopup({
  type: 'ajax',

  ajax: {
    settings: {
      cache:false, 
      data: { 
        'route_name': 'zZzzzz',
      }
    },

    cursor: 'mfp-ajax-cur', // CSS class that will be added to body during the loading (adds "progress" cursor)
    tError: '<a href="%url%">The content</a> could not be loaded.' //  Error message, can contain %curr% and %total% tags if gallery is enabled
  },

});

Но, переменная не передается

Принимаю соответственно следующим образом:

if ( $_POST ) {
    $route_name = $_POST["route_name"];
}

1 ответ 1

1

Вопрос решается добавлением метода в параметры

$('.link_popup').magnificPopup({
  type: 'ajax',

  ajax: {
    settings: {
      method: "POST",
      cache: false, 
      data: { 
        'route_name': 'Zzzz',
      }
    },

    cursor: 'mfp-ajax-cur', // CSS class that will be added to body during the loading (adds "progress" cursor)
    tError: '<a href="%url%">The content</a> could not be loaded.' //  Error message, can contain %curr% and %total% tags if gallery is enabled
  },

});

Ваш ответ

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

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