title: Sweet Alert confirm with Node JS and Express
body: <p>I have a Node JS/Express app using .EJS templates and I'm using the following code to popup standard 'Are You Sure' messages before editing or deleting a record.  Both of these are working fine:</p>
  
  <pre><code>&lt;a id="edit-form" href="/blog/&lt;%-blog._id%&gt;/edit" onclick="return confirm('Are you sure you wish to edit this blog post?');"&gt;
      &lt;div class="new-show-icons"&gt;&lt;i class="far fa-edit"&gt;&lt;/i&gt;&lt;/div&gt;
  &lt;/a&gt;
  &lt;form id="btn-form" action="/blog/&lt;%- blog._id %&gt;?_method=DELETE" method="POST" onclick="return confirm('Are you sure you wish to delete this blog post?');"&gt;
      &lt;div class="new-show-icons"&gt;&lt;i class="far fa-trash-alt"&gt;&lt;/i&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here is a the JS code I have so far for the popups, but I'm unsure 1) how to replace these to popup up in place of the standard html confirm message, and 2) how to specify what action should be taken if the user confirms or cancels (in case of edit, bring them to the edit page, and in case of delete, direct delete the record).  Any help is appreciated.  Thanks</p>
  
  <pre><code>function areYouSureEdit() {
      swal({
          title: "Are you sure you wish to edit this record?",
          type: "warning",
          showCancelButton: true,
          confirmButtonColor: '#DD6B55',
          confirmButtonText: 'Yes!',
          closeOnConfirm: false,
      },
      function(){
  
      });
  };
  
  function areYouSureDelete() {
      swal({
          title: "Are you sure you wish to delete this record?",
          type: "warning",
          showCancelButton: true,
          confirmButtonColor: '#DD6B55',
          confirmButtonText: 'Yes, delete it!',
          closeOnConfirm: false,
      },
      function(){
          swal("Deleted!", "Your imaginary file has been deleted!", "success");
      });
  };
  </code></pre>
  
  <p>However, I would like to make sure of 'Sweet Alert' confirm messages, which I am struggling with.  </p>