@mrzgt

Почему не передаеться переменная?

есть js
$(document).ready(function() {
$(document).on("click touchstart", "#call-order-submit", function (e) {
		$.ajax({
			url: 'index.php?route=module/callback/write',
			type: 'post',
			dataType: 'json',
			data: $('input[name=\'callback_contact\'],input[name=\'callback_firstname\'],input[name=\'callback_email\'],input[name=\'callback_timein\'],input[name=\'callback_timeoff\'],textarea[name=\'callback_comment\']'),			
			success: function (data) {
				if (data['error']) {
					$('.callback .error').remove();
					if (data['error']['firstname']) {
						$('.callback_errorfirstname').html('<span class="text-danger">'+data['error']['firstname']+'</span>').show();
					} else {
                   $('.callback_errorfirstname').hide().empty();
                           }
					if (data['error']['contact']) {
						$('.callback_errorcontact').html('<span class="text-danger">'+data['error']['contact']+'</span>').show();
					} else {
                   $('.callback_errorcontact').hide().empty();
                           }
					if (data['error']['email']) {
						$('.callback_erroremail').html('<span class="text-danger">'+data['error']['email']+'</span>').show();
					} else {
                   $('.callback_erroremail').hide().empty();
                           }
				}
				if (data['success']) {
						setTimeout(function() {		
					$.magnificPopup.close();
						 }, 5500);	
					$.magnificPopup.open({
				  items: {
					src: 'index.php?route=module/callback/success'
				  },
				  type: 'ajax'
				});
				}
			}
		});
	});
$('.call-order').bind('click', function(){
		$.magnificPopup.open({
            items: {
              src: 'index.php?route=module/callback/getForm'
            },
			 type: 'ajax'
          });
});

});


так все работает,но если index.php?route=module/callback/getForm подгружать не в magnificPopup, а
$('.call-order').load('index.php?route=module/callback/getForm');

то в функции url: 'index.php?route=module/callback/write',
$contact = $this->request->post['callback_contact'];

и все другие переменные не доходят
  • Вопрос задан
  • 109 просмотров
Пригласить эксперта
Ответы на вопрос 1
webinar
@webinar
Учим yii: https://youtu.be/-WRMlGHLgRg
Может потому что index.php?route=module/callback/write это GET запрос, а не POST, поэтому $this->request->post пуст как и ожидается.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы