如果我双击提交按钮,我有一个只会提交的表单。此外,如果我不取消绑定('submit'),那么它根本不会触发。我需要更改的任何想法,只需单击一下即可。提前致谢。
$('#formID').submit(function (event)
{
event.preventDefault();
var InspectionDate = $('#datepicker').val().split('/');
InspectionDate.reverse();
InspectionDate = InspectionDate.join('-');
InspectionHour = $('#time_hour').val();
InspectionMinutes = $('#time_minutes').val();
var InspectionDateTime = InspectionDate + ' ' + InspectionHour + ':' + InspectionMinutes + ':00';
$.ajax(
{
type: "POST",
url: "ajax_booking_check.php",
data: 'InspectionDateTime=' + InspectionDateTime,
cache: false,
success: function (response)
{
if (response == 1)
{
alert("An appointment for the selected Date and Time already exists.\n\nDouble Bookings are not possible.\n\nPlease refer to the calender to find an available appointment.");
}
else
{
$('#formID').unbind('submit').submit();
}
}
});