0

送信ボタンをダブルクリックした場合にのみ送信されるフォームがあります。また、unbind('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();
            }
        }
    });
4

1 に答える 1