SHARE
TWEET

Untitled

a guest Jan 24th, 2020 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;(function($){
  2.     $(document).ready(function(){
  3.         $('.reservation-form-status').hide();
  4.         $('#reservation-form').submit(function(){
  5.             event.preventDefault();
  6.             var submitUrl = $(this).attr('action'),
  7.                 method = $(this).attr('method'),
  8.                 data = $(this).serialize()+'&action=reservation';
  9.             $.ajax({
  10.                 type : method,
  11.                 url : submitUrl,
  12.                 data : data,
  13.                 beforeSend : function(){
  14.                     $('input[name="reservation-submit"]').val('Reserving...');
  15.                 },
  16.                 success : function(data){
  17.                     var data = $.trim(data);
  18.                     $('input[name="reservation-submit"]').val('Reservie Now');
  19.                     $('.reservation-form-status').show();
  20.                     if(data == 'not_allowed'){
  21.                         $('.reservation-form-status').text('Sorry! You are not allowed');
  22.                     }else if(data == 'empty_fields'){
  23.                         $('.reservation-form-status').text('All fields must filled out');
  24.                     }else if(data == 'email_not_valid'){
  25.                         $('.reservation-form-status').text('Email address not valid');
  26.                     }else if(data == 'already_taken'){
  27.                         $('.reservation-form-status').text('A reservation already taken your id. No need submit again!');
  28.                     }else if(data == 'query_failed'){
  29.                         $('.reservation-form-status').text('Something went wrong!');
  30.                     }else{
  31.                         $('.reservation-form-status').text('Your Reservation is taken please pay to confirm.');
  32.                         $('input[name="reservation-submit"]').hide();
  33.                         $('#reservationCheckoutLink').show();
  34.                     }
  35.                 }
  36.             });
  37.         });
  38.     });
  39. })(jQuery);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top