Sweetalert2 – Including a link in the popup

This is my SWAL code:

  Swal.queue([
    {
      title: 'Get Freight Rates',
      text:
        'Loading Rates for these details:' +
        JSON.stringify(transactionDetails),
      showLoaderOnConfirm: true,
      // closeModal: false,
      preConfirm: function (s) {
        console.log('s' + s)
        getRates(transactionDetails)
          .then(function (data) {
            Swal.insertQueueStep({
              html: JSON.stringify(data)
            })
          })
          .catch(function () {
            Swal.insertQueueStep({
              icon: 'error',
              title: 'Error pulling rates from the API'
            })
          })
      } // END PRECONFIRM
    }
  ]) //END THE SWAL QUEUE

In the HTML returned from the function I have a link. I’d like it to call a function on the page the popup was called from and close the popup. Any advice?

Another question: I want to show a loader while my function is running. I can’t seem to format it properly. The Code as it is now Shows you the popup with the OK. when you click ok the function runs but the screen reamains the same (but frozen) and when when the function is complete we see the loader for a millisec and then the results.

Rookie Asked on December 24, 2020 in SuiteScript.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor