title: Sweet Alert Delete Confirmation with a href
body: <p>Im using PHP, and Sweet alert for a delete confirmation. Problem is that it is deleting before showing the sweet alert. </p>
  
  <p>This is my HTML(which is using PHP in it). </p>
  
  <pre><code>&lt;div class="delete"&gt;&lt;a onclick="return confirmation()" href="'.URLROOT.'/dashboards/delete_note/'.htmlspecialchars($note-&gt;note_id).'/'.$data['table'] .'"&gt;&lt;i class="far fa-trash-alt"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/div&gt;
  </code></pre>
  
  <p>This is my sweet alert </p>
  
  <pre><code>function confirmation() {
  swal({
    title: "Are you sure?",
    text: "Once deleted, you will not be able to recover this imaginary file!",
    icon: "warning",
    buttons: true,
    dangerMode: true,
  })
  .then((willDelete) =&gt; {
    if (willDelete) {
      swal("Poof! Your imaginary file has been deleted!", {
        icon: "success",
      });
    } else {
      swal("Your imaginary file is safe!");
    }
  });
  </code></pre>
  
  <p>}</p>
  
  <p>The problem is, its not showing the sweet alert, its just going straight to the URL. Do I need to do a form and prevent submits or something like that? </p>