【发布时间】:2021-01-30 00:56:47
【问题描述】:
我正在尝试在支付成功时向数据库添加一个布尔值。
<script>
paypal.Buttons({
createOrder: function(data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: '0.01'
}
}]
});
},
onApprove: function(data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
// This function shows a transaction success message to your buyer.
alert('Transaction completed by ' + details.payer.name.given_name);
$.ajax({
url: "includes/payment_db.php",
success: function(data) {
alert('Successfully called');
},
error: function(jqxhr, status, exception) {
alert('Exception:', exception);
}
});
});
}
}).render('#paypal-button-container');
ajax 功能不工作。它不显示任何错误或成功消息。
【问题讨论】:
标签: javascript ajax paypal paypal-sandbox