jQueryを使ってレコード削除の確認ダイアログボックスを作成する方法についてお聞きしたいです。グーグルで検索してみましたが初心者なのでよくわかりません。さらに、私はすでに Javascript アラートを実装しましたが、技術的な要件は、ネイティブ Javascript アラートの代わりに jQuery ダイアログを使用することです。助けてください。前もって感謝します。ステップバイステップのガイドがある参照リンクも高く評価されます。どうもありがとう。
以下は、更新が必要な現在のコードです。
$('.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');
});
},