我想问一下如何使用jQuery创建一个用于删除记录的对话框确认框。我试图在谷歌搜索,但我不太了解,因为我是这个领域的新手。此外,我已经实现了 Javascript 警报,但技术要求是使用 jQuery 对话框而不是原生 Javascript 警报。请帮忙。提前致谢。任何具有分步指南的参考链接也将不胜感激。非常感谢。
以下是我当前需要更新的代码。
$('.delete').click(function () {
  var pKey = $(this).parent().siblings()[0].innerText;
  //Get the Id of the record to delete
  var record_id = $(this).attr("id");
  //Get the GridView Row reference
  var tr_id = $(this).parents("#.record");
  // Ask user's confirmation before delete records
  if (confirm("Are you sure you want to delete this record?")) {
    $.ajax({
      type: "POST",
      url: '../SampleOnly.asmx/Delete',
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      //Pass the selected record id
      data: "{ 'Id':'" + pKey + "'}",
      success: function (data) {
        // Change the back color of the Row before deleting
        tr_id.css("background-color", "blue");
        Do some animation effect
        tr_id.fadeOut(500, function () {
          //Remove GridView row
          tr_id.remove();
          alert(' The record has been deleted successfully');
        });
      },