首页 > 解决方案 > 如何在 Twig 语法中使用 post 方法

问题描述

您好我正在尝试按照使用 twig 的代码将 tpl 文件转换为 twig 语法。我的问题是可以在树枝语法中使用 post 函数吗?

<script>
 $(document).ready(function(){$('#jb-cancel-order').click(function(){
 if(confirm('Are you sure want to cancel this?')) {
 $.post('index.php?route=account/order/jbcancelorder',{order_id: {{order_id}},email:'{{customer_email}}'},function(e){
if(e.status=='ok'){
    $('#jb-cancel-order').remove();
}
},'json');
}
return false;
});});
</script>]]>

在运行网页时,它只显示弹出消息,没有任何预期的操作。取消不会被触发。发布方法不起作用。参考代码:https ://github.com/jericbas/jb_allow_order_cancel_24_hours

提前致谢

标签: javascriptphpjsontwig

解决方案


推荐阅读