I am creating a small web application using WordPress. I'm using Ajax to make multiple calls for a reservation system.
I have 4 steps (Get Industry's, Get Consultants in Industry, Get available times of that consultant, and then make reservation.
It works perfectly in Chrome, but then we get to Microsoft Edge (Windows 10).
All three steps are working properly until the last.
//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");
}
});
}
The function is not passing the user, or the cName (Consultant)... Which returns on success
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();
}