【发布时间】:2019-02-04 19:41:42
【问题描述】:
我在 woocommerce 中开发了自定义网关插件。我正在通过 jquery ajax 提交订单并通过成功事件获得响应并处理付款。在提交 ajax 时向 3rd 方服务器提交多次。如何避免它。
function payment_field(){ ?>
<script>
var success = function(response){
jquery.ajax({
handle the response through ajax and redirect the page
})
}
jQuery("form.woocommerce-checkout").on('submit', function (e) {
//submitinfo to the server
//Pblm with sending multiple times to server
}
【问题讨论】:
-
函数体中的
<script>标签是什么? -
你在哪里调用 payment_field() 以及调用了多少次?
标签: jquery wordpress woocommerce