How to call a function inside the success in SWAL using JQuery?

后端 未结 1 1626
盖世英雄少女心
盖世英雄少女心 2021-01-28 20:39

Second function is not working. It doesn\'t received the id that being passed from the first function.

Here is my JQuery code.

swal({
    title: \"Are yo         


        
相关标签:
1条回答
  • 2021-01-28 20:56

    A swal instance is a promise. To add functions based on user action, you have to use the then() method.

    Here is the structure of a swal with chained catch() and then() methods.

    swal({
        // The swal configuration params
      })
    
      // To avoid getting a "cancel" if user click the close button
      // or clicks on the overlay (outside the swal)
      // "noop" means "no operation".
      .catch(swal.noop)
    
      // To handle the confirm/cancel buttons
      .then(function (result) {
        if (result) {
          // Your "confirm" function
        }
        if (!result) {
          // Your "cancel" function
        }
      });
    
    0 讨论(0)
提交回复
热议问题