削除操作が正常に完了したら、モーダルを解除するという課題に直面しています。以下はボタンをクリックしてもモーダルダイヤルボックスが存在する
アクションでモーダルのスクリーンショットです:
「キャンセル」ボタンの上に私をクリックすると、「削除」ボタンとは異なり、予想通り、モーダルが閉じます。成功した操作であっても。
私はおそらく間違っていますが、どうすれば修正できますか?
以下は私のコードです。
はモーダルダイアログボックス:
<div class="modal fade" id="confirm-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
</div>
<div class="modal-body">
<p>You are about to delete one track, this procedure is irreversible.</p>
<p>Do you want to proceed?</p>
<p class="debug-url"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<a class="btn btn-danger btn-ok">Delete</a>
</div>
</div>
</div>
</div>
モーダルダイアログボックスをトリガーボタンの背後にあるコードは次のとおりです。
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#confirm-delete" id="delete" style="display: none;">Delete</button>
その後
、私のスクリプト(すべての操作を処理するために) :
$('#confirm-delete').on('show.bs.modal', function(e) {
var rowid = json_array['rowid'];
$('.btn-ok').click(function() {
$.ajax({
url: 'delete_record.php',
type: "post",
async: true,
data: ({ row_id : rowid }),
success: function(data) {
}
});
});
);
一部が? –
@RubelDinira、私の[answer](http://stackoverflow.com/a/40316736/2545680)を確認してください。 –
@RabelDinira Maximusがそれを手に入れました! :P –