JQuery Ajax (Wordpress) не передает все мои переменные POST

Я создаю небольшое веб-приложение с использованием WordPress. Я использую Ajax, чтобы сделать несколько звонков для системы бронирования.

У меня есть 4 шага (Получить Промышленность, Получить Консультантов в Промышленности, Получить доступное время этого консультанта, а затем сделать заказ.

Он отлично работает в Chrome, но затем мы переходим к Microsoft Edge (Windows 10).

Все три шага работают должным образом до последнего.

//Function for Appointment submission
function makeAppointment( uid, day, time, customer, cName, cCategory ) {
    $.ajax({
    url: ajaxurl + "?action=saveAppointment",
    type: 'post',
    cache: false,
    data: {
        user: uid,
        customer: customer,
        day: day,
        time: time,
        cName: cName,
        cCat: cCategory,
    },
    dataType: 'html',
    success: function(data) {
    console.log("Appointment Added!");
    var alertMessage;
    //Pass the confirmation message to the Alert popup
    $('#alert .message').html(data);
    //Enable the popup
    $('#alert').addClass("on");
    },
     error: function(data) {
     console.log("FAILURE");
    }
    });
}

Функция не передает пользователя или cName (Консультант)... Что возвращает в случае успеха

    function saveAppointment() {
    $userID = $_POST['user'];
    $customerID = $_POST['customer'];

    $consultCat = $_POST['cCat'];

    $conName = $_POST['cName'];

    $customerArray = array();
    array_push($customerArray, $customerID );

    $day = str_replace("-", " ", $_POST['day']);
    $time = $_POST['time'];



    // Set variables
    $row = array(
    'field_5a7d085c0d0f3'   => $day,
    'field_5a7d1c9d63b5a'   => $time,
    'field_5a7d03afbfcbf'   => $customerID
    );

    add_row('field_5a7cfd494890d', $row, 'user_'. $userID);


    //Get User ID to send email
    $user_info = get_userdata($customerID);
    $user_email = $user_info->user_email;

    $subject = 'Business Bootcamp Appointment Confirmation for ' . $day . ', 2018 at ' . $time;
    $body = 'The email body content';
    $headers = array('Content-Type: text/html; charset=UTF-8');

    wp_mail( $user_email, $subject, $body, $headers );



    $content.= '<p>Your Free<br/><span class="underlined">' . $consultCat . '</span><br/>Consultation with<br/><span class="underlined">' . $conName . '</span></br>Has Been Booked For:<br/><span class="underlined">' . $day . 'TH @ ' . $time . '</span></p>';
    $content.='<p class="smaller">A confirmation email has been sent!';
    echo $content;
    die();
}

0 ответов

Другие вопросы по тегам