2

私の Web ページは、テーブルの行を削除し、データベースに自動的に保存します。messageBox削除ボタンをクリックした後、「保存」と「いいえ」の2つのボタンが必要です。jspの削除機能は次のとおりです。

function deleteFileRow(rowCount)
{
 $.ajax(
    {
      url: 'deleteRow.htm?rowIndex='+rowCount+"&action=delete&id="+${id},
       success: function(data)
       {
          document.location.reload();
       }
    });
}

これを行う際に私を助けてください。

4

3 に答える 3

4

jquery 確認ボックスを使用して、yes または no を追加します。

ConfirmDialog('Are you sure');

function ConfirmDialog(message){
$('<div></div>').appendTo('body')
                .html('<div><h6>'+message+'?</h6></div>')
                .dialog({
                    modal: true, title: 'Delete message', zIndex: 10000, autoOpen: true,
                    width: 'auto', resizable: false,
                    buttons: {
                        Yes: function () {
                            // $(obj).removeAttr('onclick');                                
                            // $(obj).parents('.Parent').remove();

                            $(this).dialog("close");
                        },
                        No: function () {
                            $(this).dialog("close");
                        }
                    },
                    close: function (event, ui) {
                        $(this).remove();
                    }
                });
};

ref http://jsfiddle.net/nM3Zc/

于 2013-07-29T05:53:39.797 に答える
1

ここでは、javascript で yes/no と質問を含む messageBox をポップする方法を見つけることができます。「保存」/「いいえ」で決定されない場合は、それを使用できます。

var nRslt = app.alert ("Press \"yes\" to save\n" + "Press \"No\" to delete";, 2, 2, "Submit Validation"); 
if(nRslt == 4) { // User Pressed Yes, Do submission 
    this.submitForm(...); 
}
于 2013-07-29T05:48:25.963 に答える