我在woocommerce中开发了自定义网关插件。我正在通过jquery ajax提交下订单,并获得成功事件的响应并处理付款。在提交ajax时,向第三方服务器提交多倍时间。如何避免。
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
}
答案 0 :(得分:0)
将您的Submit事件移到任何函数或循环之外
jQuery("form.woocommerce-checkout").on('submit', function (e) {
//submitinfo to the server
}
function payment_field(){
//rest of the code...