Gab*_*ini 11 javascript ajax jquery simplemodal jquery-ui
我想在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();
});
}
});
}
Run Code Online (Sandbox Code Playgroud)
由于模式对话框位于页面上,因此您可以自由设置所需的任何文档变量。然而,我见过的所有模式对话框脚本都包含使用返回值的演示,因此它很可能位于该页面上。
(该网站已被屏蔽,否则我会查看)
| 归档时间: |
|
| 查看次数: |
9235 次 |
| 最近记录: |