jQuery Ajax(Wordpress)没有传递我的所有POST变量

时间:2018-02-22 05:01:56

标签: jquery ajax wordpress microsoft-edge admin-ajax

我正在使用WordPress创建一个小型Web应用程序。我正在使用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 个答案:

没有答案