jQuery DirtyForms プラグインを使用して、ユーザーが誤って保存せずにページを離れないようにしています。ダイアログ ボックスで問題が発生しています。キャンセルと保存しないという 2 つのボタンがあります。
キャンセル アクションは正しく機能しています。ダイアログが閉じ、新しいページは読み込まれません。ただし、保存しないアクションは機能しません。新しいページがロードされるはずですが、ロードされていません。
明らかな何かが欠けているに違いありません。誰かが私が間違ったことを見ることができますか?
<script type="text/javascript">
$(document).ready(function(){
$('form').dirtyForms();
});
$('a').click(function(event){
event.preventDefault();
var targetUrl = $(this).attr("href");
if($.DirtyForms.isDirty()){
$("#dialog-savechanges").dialog({
height: 250,
width: 500,
modal: true,
buttons: {
Cancel: function() {
$( this ).dialog( "close" );
$.DirtyForms.choiceContinue = false;
$.DirtyForms.choiceCommit(event);
},
"Don't Save": function() {
$( this ).dialog( "close" );
$.DirtyForms.choiceContinue = true;
$.DirtyForms.choiceCommit(event);
}
}
});
}
});
</script>
<div id="dialog-savechanges" title="Save Changes?">
<p>You've made changes to this page. Do you want to leave this page without saving?</p>
</div>
ありがとうございました!
-スティーブ