sweetalert에서 두 가지 옵션을 선택하고 해당 옵션에 따라 조치를 취하는 방법은 무엇입니까?

Patel 만나기

난 단지 소요 한 Sweetalert 가지고 OkCancle. 경우 ok는 그에 따라 옵션을 수행합니다.

두 가지 옵션이 필요합니다 : With PaymentWithout Payment. 사용자가 선택 With Payment하면 사용자에게 금액을 입력하고 다른 페이지로 보내도록 요청합니다.

내 현재 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 {}
  });
}
Cerlin

아래와 같은 것을 시도해 보셨습니까?

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;
    }
});

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관