{'ajax'.$action}(); } else { die(json_encode(array('error' => 'method doesn\'t exist'))); } } public function ajaxRefreshPreview() { $id_products = Tools::getValue('products'); ob_end_clean(); header('Content-Type: application/json'); $jxcompareproduct = new Jxcompareproduct(); $content = $jxcompareproduct->getPreview($id_products); die(json_encode(['status' => true, 'response' => $content])); } public function ajaxAddProductToPreview() { $id_product = Tools::getValue('id_product'); if ($id_product) { ob_end_clean(); header('Content-Type: application/json'); $jxcompareproduct = new Jxcompareproduct(); $content = $jxcompareproduct->getPreviewProduct($id_product); die(json_encode(['status' => true, 'response' => $content])); } } public function ajaxShowModal() { $id_products = Tools::getValue('products'); ob_end_clean(); header('Content-Type: application/json'); $jxcompareproduct = new Jxcompareproduct(); $content = $jxcompareproduct->getModal($id_products); die(json_encode(['status' => true, 'response' => $content])); } }