如何从JQuery中的modal dialog中获取结果

我想在UI工具包中使用像simple-modal这样的加载项或对话框加载项。 但是,我如何使用这些或其他任何结果并获得结果。 基本上我希望模态与服务器进行一些ajax交互,并返回调用代码的结果来做一些事情。 谢谢。

以下是确认窗口在simpleModal上的工作方式:

$(document).ready(function () { $('#confirmDialog input:eq(0)').click(function (e) { e.preventDefault(); // example of calling the confirm function // you must use a callback function to perform the "yes" action confirm("Continue to the SimpleModal Project page?", function () { window.location.href = 'http://www.ericmmartin.com/projects/simplemodal/'; }); }); }); function confirm(message, callback) { $('#confirm').modal({ close: false, overlayId: 'confirmModalOverlay', containerId: 'confirmModalContainer', onShow: function (dialog) { dialog.data.find('.message').append(message); // if the user clicks "yes" dialog.data.find('.yes').click(function () { // call the callback if ($.isFunction(callback)) { callback.apply(); } // close the dialog $.modal.close(); }); } }); } 

由于模式对话框位于页面上,因此您可以自由设置所需的任何文档变量。 但是我见过的所有modal dialog脚本都包含一个使用返回值的演示,所以很可能在该页面上。

(该网站被我阻止,否则我会看)