Javascript fire PHP after success

I hope I can get some help over here because i’m stuck with that. I’m kinda new to programing and try to understand how this works.

I’ve this following code to generate my table

<tbody>
    <?php
      $stmt = $pdo->prepare("SELECT * FROM videos");
      $stmt->execute();
      $results = $stmt->fetchAll(PDO::FETCH_OBJ);
      if($stmt->rowCount() > 0){
        foreach($results as $result){?>
        <tr>
          <td class="fw-semibold fs-sm"><?= $result->title; ?></td>
          <?php
            if($result->access == '***'){?>
              <td class="d-none d-sm-table-cell fs-sm">
                <span class="fs-xs fw-semibold d-inline-block py-1 px-3 rounded-pill bg-warning-light text-warning">***</span>
              </td>
          <?php }else{?>
              <td class="d-none d-sm-table-cell fs-sm">
                <span class="fs-xs fw-semibold d-inline-block py-1 px-3 rounded-pill bg-success-light text-success">***</span>
              </td>
          <?php } ?>
          <td class="d-none d-sm-table-cell">
          <?= convert($result->size); ?>
          </td>
          <td>
            <span class="text-muted fs-sm"><?= date( 'd.m.Y H:i', strtotime(str_replace('.','-',$result->date))); ?></span>
          </td>
          <td class="text-center">
            <div class="btn-group">
              <button type="button" class="btn btn-sm btn-alt-secondary" data-bs-toggle="tooltip" title="Edit">
                <i class="fa fa-fw fa-pencil-alt"></i>
              </button>
              <button type="button" class="btn btn-sm btn-alt-secondary" data-bs-toggle="tooltip" title="Share">
                <i class="fa fa-fw fa-share"></i>
              </button>
              <button type="button" class="btn btn-sm btn-alt-secondary" data-bs-toggle="tooltip" title="View">
                <i class="fa fa-fw fa-eye"></i>
              </button>


              <!-- 
                Here is the button to delete with confirmation 'js-swal-confirm' 
                to get the ID from the table i'd use this 
                <?php // $result->id; ?>
              -->
              <button type="button" class="js-swal-confirm btn btn-sm btn-alt-danger" data-bs-toggle="tooltip" title="Delete">
                <i class="fa fa-fw fa-times"></i>
              </button>
            </div>
          </td>
        </tr>
    <?php }
      }
    ?>
</tbody>

now my javascript code where i’m stuck at because I don’t know where I could start with.
I got this code from the internet and changed some codes about it to get it done how I want it.
This is how it looks right now

<script>
  One.onLoad(class {
    static sweetAlert2() {
      let e = Swal.mixin({
        buttonsStyling: !1,
        target: "#page-container",
        customClass: {
          confirmButton: "btn btn-success m-1",
          cancelButton: "btn btn-danger m-1",
          input: "form-control"
        }
      });
      document.querySelector(".js-swal-confirm").addEventListener("click", (t => {
        e.fire({
          title: "Are you sure?",
          text: "You will not be able to recover this file!",
          icon: "warning",
          showCancelButton: !0,
          customClass: {
            confirmButton: "btn btn-danger m-1",
            cancelButton: "btn btn-secondary m-1"
          },
          confirmButtonText: "Yes, delete it!",
          html: !1,
          preConfirm: e => new Promise((e => {
            setTimeout((() => {
              e()
            }), 50)
          }))
        }).then((t => {
          t.value ? e.fire("Deleted!", "Your file has been deleted.", "success") : "cancel" === t.dismiss && e.fire("Cancelled", "Your file is safe :)", "error")
        }))
      }))
    }
    static init() {
      this.sweetAlert2()
    }
  }.init());
</script>

So what I want is, when the button is pressed and clicked on “Yes, delete it!”, it should fire a php script in the background where the ID is posted with a $_GET[''] function so it can delete the entry from the database and even the file from the server. Or is there even a faster better solution for this?
All I want is a security before the file is getting deleted from the table ( mysql, server ) and this popup should warn the user before the file is actuall getting deleted means confirmation with a warning text.
I couldn’t try anything at all because I do not know where to start at all. PHP is no problem, but the javascript part is for me hard. So any help would be amazing.