我有一個只需要Ok和 的 Sweetalert Cancle。如果ok它根據(jù)那個執(zhí)行選項。我需要兩個選項:With Payment和Without Payment. 如果用戶選擇With Payment,它將要求用戶輸入金額并將其發(fā)送到另一個頁面。我當前的order.list.js頁面是這樣的function completeOrder(orderID) { var obj = { order: order, page: page, customer: $("#customers_" + from).val(), sdate: $("#sdate_" + from).val(), edate: $("#edate_" + from).val(), Status: Status }; swal({ title: "Are you sure?", text: "You want to complete this order Without Payment !!", icon: "warning", buttons: true, dangerMode: true, }).then((willDelete) => { if (willDelete) { $.ajax({ url: "process/order-process.php", type: "POST", data: { orderID: orderID, status: "Completed", payment: "Not Paid" }, beforeSend: function() {}, success: function(response) { if (response.indexOf("success") >= 0) { swal("Good job! Your order has been completed!", { icon: "success", }); getResult(true, 'process/order-list.php', "POST", JSON.stringify(obj), from); } else { swal("Error!", "Something went wrong!", "error"); } } }); } else {} });}
1 回答

蕭十郎
TA貢獻1815條經(jīng)驗 獲得超13個贊
你有沒有嘗試過下面這樣的事情
swal("Place the order?", {
title: "Are you sure?",
text: "You want to complete this order Without Payment !!",
icon: "warning",
buttons: {
withPayment: "With Payment",
withOutPayment: "With out Payment",
}
})
.then((value) => {
switch (value) {
case "withPayment":
// Proceed with payment
break;
case "withOutPayment":
// Proceed without payment
break;
}
});
- 1 回答
- 0 關注
- 121 瀏覽
添加回答
舉報
0/150
提交
取消