我有以下代码:
<body>
<div id="dialog-form" title="Create a new Comment">
<form>
<fieldset>
<label for="name">Enter your Comment Please </label>
<textarea rows="6" cols="2" name="commentArea" id="commentArea" ></textarea>
</fieldset>
</form>
</div>
<button id="create-user">Create new user</button>
</body>
和我使用 jquery-UI 的模态窗口
<g:javascript>
$(function(){
$("#dialog-form").dialog ({
autoOpen:false,
height:300,
resizable:false,
width:350,
modal:true,
buttons: {
"Attach Comment": function() {
alert('assum it already submitted'); // ? ? ? this time what can i add to post a form to a controller attachComments with commentArea posted.
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
},
close: function() {
alert(Form is cloased!);
$(this).dialog("close");
}
});
$( "#create-user" )
.button()
.click(function() {
$( "#dialog-form" ).dialog( "open" );
});
});
</g:javascript>
上面的代码绘制了我的模态窗口,但是我如何将表单发布到 attachCommentController 并接收回复以在模态窗口上显示错误?