【发布时间】:2019-06-22 08:54:43
【问题描述】:
我正在开发自定义支付网关,我需要通过插件目录中的自定义 php 文件处理 tranasaction_id 和其他支付详细信息。此外,我得到了 4 次 ajax 请求加载响应,我得到了如何避免它。
// plugin class file payment-gateway.php
//response.status ="approved";
//response.transaction_id ="324234";
var dataString = JSON.stringify(response);
jQuery.ajax({
type : "POST",
dataType : "json",
contentType: "application/json",
url: '<?php echo plugins_url().'/custom-woocommerce-gateway/includes/custom_php_file.php'; ?>',
data: {myData:dataString},
success: function(response) {
}
});
/*custom-woocommerce-gateway/includes/custom_php_file.php */
<?php
//define the wc functions
print_r($_REQUEST);
process the payment details like woocommerce
exit;
【问题讨论】:
标签: php jquery wordpress plugins woocommerce