以下のコードを使用してjQuery uiダイアログを作成しました。それはうまくいきました。しかし、閉じるボタンが機能していません。ダイアログに「取引を追加」ボタンを追加しました。ボタンをクリックすると、取引を追加するコントローラーアクションを呼び出したいと同時に、ダイアログが消えず、同じ内容が表示されます。この問題に対する提案はありますか。
<script type="text/javascript">
$(function () {
$('#divtrade').dialog({
autoOpen: false,
width: 1400,
height: 600,
resizable: false,
title: 'New Trades',
modal: true,
buttons: {
"Close": function () {
//close button not working
$('#divtrade').dialog("close");
},
"Add Trade": function () {
//how to invoke controller to add trade using jquery, at the same time
//dialog should not disappear, it should show the previous view
}
}
});
});
$('.newtrade').click(function () {
$('#divtrade').load('@Url.Action("NewTrade","Trade")').dialog('open');
});
</script>
<div id="divtrade" style="display:none;"></div>