@rinaz22

Есть AJAX код, который отправляет POST данные в php. Как их принять в php?

Всем привет! AJAX код отправляет post данные в php файл. Как принять эти post данные в php?
Вот AJAX:
$('#receive_2').submit(function(){
        if($.trim($('#receive_fio_2').val()) == '') {
            $('#receive_fio_2').removeClass('ok');
            $('#receive_fio_2').addClass('error');
            return false;
        }
        if($.trim($('#receive_phone_2').val()) == '') {
            $('#receive_phone_2').removeClass('ok');
            $('#receive_phone_2').addClass('error');
            return false;
        }
        if($('#receive_email_2').val() == '') {
            $('#receive_email_2').next().html('Поле обязательно для заполнения');
            $('#receive_email_2').removeClass('ok');
            $('#receive_email_2').addClass('error');
            return false;
        }
        if(!isValidEmailAddress($('#receive_email_2').val())) {
            $('#receive_email_2').next().html('Не правильный формат Email');
            $('#receive_email_2').removeClass('ok');
            $('#receive_email_2').addClass('error');
            return false;
        }
        $("#receive_2 input[type='submit']").prop('disabled', true);
        $("#receive_2 .circle-loader").addClass('active');
        $('input[type=submit], button[type=submit]').css('pointer-events', 'none');
        $.ajax({
            url:'mailing/receive_2.php',
            data: $(this).serialize(),
            type: 'POST',
            cache: false,
            success: function(data){
                if($('#receive_fio_2').val().length > 0) {
                    $('#thanks-name').html($('#receive_fio_2').val());
                } else {
                    $('#thanks-title').html('Спасибо за обращение');
                }
                thanksByTime();
                $("#receive_2 .circle-loader").removeClass('active');
                $("#receive_2 input[type='submit']").prop('disabled', false);
                ga('send', 'event', 'poluchit predlogeni', 'otpravka formi');
                yaCounter35070735.reachGoal("clickaddForma");
                $('#receive_reset_2').click();
                $('#thanks').click()
                showPopup = false;
                $('input[type=submit], button[type=submit]').css('pointer-events', 'auto');
            },
            error: function(XMLHttpRequest, textStatus, errorThrown){
                $('input[type=submit], button[type=submit]').css('pointer-events', 'auto');
            }
        });
        return false;
    });
  • Вопрос задан
  • 93 просмотра
Пригласить эксперта
Ответы на вопрос 1
BigHead
@BigHead
Please fill the field.
$_POST
Ответ написан
Комментировать
Ваш ответ на вопрос

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

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