Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;(function($){
- $(document).ready(function(){
- $('.reservation-form-status').hide();
- $('#reservation-form').submit(function(){
- event.preventDefault();
- var submitUrl = $(this).attr('action'),
- method = $(this).attr('method'),
- data = $(this).serialize()+'&action=reservation';
- $.ajax({
- type : method,
- url : submitUrl,
- data : data,
- beforeSend : function(){
- $('input[name="reservation-submit"]').val('Reserving...');
- },
- success : function(data){
- var data = $.trim(data);
- $('input[name="reservation-submit"]').val('Reservie Now');
- $('.reservation-form-status').show();
- if(data == 'not_allowed'){
- $('.reservation-form-status').text('Sorry! You are not allowed');
- }else if(data == 'empty_fields'){
- $('.reservation-form-status').text('All fields must filled out');
- }else if(data == 'email_not_valid'){
- $('.reservation-form-status').text('Email address not valid');
- }else if(data == 'already_taken'){
- $('.reservation-form-status').text('A reservation already taken your id. No need submit again!');
- }else if(data == 'query_failed'){
- $('.reservation-form-status').text('Something went wrong!');
- }else{
- $('.reservation-form-status').text('Your Reservation is taken please pay to confirm.');
- $('input[name="reservation-submit"]').hide();
- $('#reservationCheckoutLink').show();
- }
- }
- });
- });
- });
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement