Ajax请求在prestashop 1.6中覆盖控制器

时间:2015-04-21 15:03:12

标签: ajax controller override prestashop

除了来自prestashop模块的ajax请求的传统方法之外,我想使用product.js中的ajax方法并从覆盖控制器中检索数据。

我在product.js中的功能:

function attrReference(ref){
    $.ajax({
        url: baseUri,
        async: true,
        cache: false,
        type:'GET',
        dataType : "json",
        headers: { "cache-control": "no-cache" },
        data: {
                controller :'product',
                action :'attrReference',
                token : token,
                ajax: 1,
                ref : ref
        },
        success: function(data){

        }
    });
}

我的覆盖控制器产品:

class ProductController扩展了ProductControllerCore {

public function displayAjaxAttrReference(){
   echo '<pre style="background:yellow">';
   print_r($_GET);
   echo '</pre>';
   exit;
}

}

从文档中,我使用displayAjax来恢复数据,除非这不是正确的方法,我尝试了很多尝试,但没有一个是正确的。

你有什么想法吗?

0 个答案:

没有答案