Prestashop add a token to ajax file

◇◆丶佛笑我妖孽 提交于 2019-12-25 04:26:11

问题


I tried sending to my module prestashop addons. I got a message "Technical validation has been declined". This message contain the

You need to add a token to your ajax file.

My ajax script is:

$.ajax({
        type: "post", 
        url : "../modules/priceupdate/ajax-call.php",
        data: "ajax=ps_ajax_update_prices",
        success : function(response){
            $('#update-ajaxresponse').html(response)
        }
    });

Regards


回答1:


Usually the token are declared by PrestaShop, you should to add only the token in your data:

$.ajax({
    type: "post", 
    url : "../modules/priceupdate/ajax-call.php",
    data: "ajax=ps_ajax_update_prices&token=" + token ,
    success : function(response){
        $('#update-ajaxresponse').html(response)
    }
});


来源:https://stackoverflow.com/questions/40945551/prestashop-add-a-token-to-ajax-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!