javascript - 如何在 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
提前致谢
解决方案
推荐阅读
- html - 未应用 Django CSS 更改
- python-3.x - 接受不同类型的日期格式python 3并计算差异
- java - 如何从 servlet 中的链接 app/page/par 获取参数“par”?
- sql - 具有超过 1 个值的单元格的嵌套 SQL IN 语句
- blazor - 强制 Blazor webassembly 在客户端使用 Newtonsoft.Json
- mongodb - Mongodb聚合获取搜索结果的计数
- django - Post() 得到了一个意外的关键字参数“用户”
- python - Linux 中脚本文件的非可读/可编辑文件格式
- python - 在 Tensorflow 2.0 中使用我的自定义嵌入层时出错
- java - Junit 测试 5(例外)