div からダイアログを読み込んでいます
<div id="dialog-message" title="Send Message" style="display: none;">
<form id ="form_message">
<textarea name="message_field" id="message_field" rows="8" cols="62" class="ui-widget-content ui-corner-all" style="resize: none;"></textarea>
</form>
$(document).ready(function() 内にダイアログを作成し、リンクを使用して開きます。ダイアログの送信時に、ダイアログの内容を戻りメッセージで変更し、ユーザーはウィンドウを閉じることができます。
// dialog create
$("#dialog-message").dialog({
autoOpen: false,
resizable: false, width: 520, height: 320,
modal: true,
buttons: {"Send": { text: "Send", id: "btn_send", click: function () {},
close: function() {if($('#form_message').length) {$(this).find('form')[0].reset();} }
});
//link to open dialog
$('#dialog_link').click(function(){$("#dialog-message").data("msg_data", {msg_from: 14, msg_to: 15}).dialog("open"); return false; });
//operations made on submit dialog
$('#btn_send').hide();
$('#dialog-message').html(data.error);
私が抱えている問題は、ダイアログをもう一度開くと、戻りメッセージが残り、元の div コンテンツが読み込まれないことです。どうすればこれを達成できますか? close イベントでダイアログを破棄しようとしましたが、ダイアログがまったく開きません。