diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 21913cc4d..ffc087ecd 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -218,7 +218,7 @@ class CategoryControllerCore extends FrontController public function displayAjaxFilterResults() { - $response = array('status' => 'ko'); + $response = array('status' => false); $this->display_header = false; $this->display_footer = false; @@ -291,10 +291,10 @@ class CategoryControllerCore extends FrontController $this->context->smarty->assign(array('booking_data' => $booking_data)); $html = $this->context->smarty->fetch('_partials/room_type_list.tpl'); - $response['status'] = 'ok'; + $response['status'] = true; $response['html_room_type_list'] = $html; } - die(json_encode($response)); + $this->ajaxDie(json_encode($response)); } /** diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 709a301e0..9b1c66ee0 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -1061,7 +1061,7 @@ class ProductControllerCore extends FrontController $response['html_booking_form'] = $html; } - die(json_encode($response)); + $this->ajaxDie(json_encode($response)); } public function displayAjaxCheckRoomAvailabilityAndRate() diff --git a/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js b/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js index 2415b6f4c..01a9dfd9b 100644 --- a/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js +++ b/modules/wkhotelfilterblock/views/js/wkhotelfilterblock.js @@ -184,7 +184,7 @@ $(document).ready(function() dataType: 'JSON', data: data, success: function (response) { - if (response.status == 'ok') { + if (response.status) { $('#category_data_cont').html(response.html_room_type_list); } } diff --git a/themes/hotel-reservation-theme/js/product.js b/themes/hotel-reservation-theme/js/product.js index a9d30a07b..ac897987f 100644 --- a/themes/hotel-reservation-theme/js/product.js +++ b/themes/hotel-reservation-theme/js/product.js @@ -1170,7 +1170,9 @@ $(document).ready(function() { }); var BookingForm = { + currentRequest: null, init: function() { + this.currentRequest = null; BookingForm.initDatepicker(); }, initDatepicker: function() { @@ -1259,7 +1261,7 @@ var BookingForm = { return data; }, refresh: function() { - $.ajax({ + BookingForm.currentRequest = $.ajax({ url: product_controller_url, type: 'POST', headers: { 'cache-control': 'no-cache' }, @@ -1269,6 +1271,11 @@ var BookingForm = { ajax: true, action: 'refreshBookingForm', }, BookingForm.getFormData()), + beforeSend: function() { + if(BookingForm.currentRequest != null) { + BookingForm.currentRequest.abort(); + } + }, success: function(response) { if (response.status == true) { $('.booking-form').replaceWith(response.html_booking_form);