View file File name : create-booking.js Content :$(document).ready(function () { //Create attraction $("#create123").click(function (event) { event.preventDefault(); if (!$('#vehicle').val() || $('#vehicle').val().length === 0) { swal({ title: "Error!", text: "Please enter vehicle_name..!", type: 'error', timer: 1500, showConfirmButton: false }); } else if (!$('#start_destination').val() || $('#start_destination').val().length === 0) { swal({ title: "Error!", text: "Please enter start_destination..!", type: 'error', timer: 1500, showConfirmButton: false }); } else if (!$('#end_destination').val() || $('#end_destination').val().length === 0) { swal({ title: "Error!", text: "Please enter end_destination..!", type: 'error', timer: 1500, showConfirmButton: false }); }else if (!$('#phone').val() || $('#phone').val().length === 0) { swal({ title: "Error!", text: "Please enter phone..!", type: 'error', timer: 1500, showConfirmButton: false }); //// }else if (!$('#uploardcv').val() || $('#uploardcv').val().length === 0) { // swal({ // title: "Error!", // text: "Please ploard Your cv..!", // type: 'error', // timer: 1500, // showConfirmButton: false // }); // }else if (!$('#uploardletter').val() || $('#uploardletter').val().length === 0) { // swal({ // title: "Error!", // text: "Please uploard Your covering letter..!", // type: 'error', // timer: 1500, // showConfirmButton: false // }); // // // } else { var formData = new FormData($('#form-data')[0]); $.ajax({ url: "ajax/create-booking.php", type: "POST", data: formData, async: false, dataType: 'json', success: function (result) { swal({ title: "Thank You !", text: "We will sent you the login details to the given email", type: 'success', timer: 2000, showConfirmButton: false }, function () { setTimeout(function () { window.location.replace("book-a-ride.php"); }, 1500); }); }, cache: false, contentType: false, processData: false }); } }); });