在 firefox 3 和 Firefox 中使用 JQuery 提交 SimpleModal 模式对话框中的 opera
我正在尝试提交一个在 SimpleModal 对话框中呈现的表单,但是当我使用 FF3 和 FF3 时,我的提交从未被调用。 Opera(Chrome、Safari 和 IE 均可使用)。 我使用以下代码:
function ShowModal(rendercontainerid, modalcontainerid, url) {
if (url == '')
return;
$.get(url, function(data) {
$(rendercontainerid).html(data);
$(rendercontainerid).modal({
close: false,
containerId: modalcontainerid,
onOpen: function(dialog) {
dialog.overlay.fadeIn('slow', function() {
dialog.container.slideDown('slow', function() {
dialog.data.fadeIn('slow');
});
});
},
onClose: function(dialog) {
dialog.data.fadeOut('slow', function() {
dialog.container.slideUp('slow', function() {
dialog.overlay.fadeOut('slow', function() {
$.modal.close(); // must call this!
});
});
});
}
});
});
}
function CloseDialog() {
$.modal.close();
}
function SubmitAndClose(rendercontainerid) {
$(rendercontainerid).find('form').submit();
CloseDialog();
window.location = window.location;
}
function AjaxSubmitAndClose(rendercontainerid) {
var form = $(rendercontainerid).find('form');
var url = $(form).attr('action');
var postData = $(form).serializeArray();
var options = {
dataType: 'json',
success: AjaxSubmitSucces
};
$(form).ajaxSubmit(options);
}
function AjaxSubmitSucces(data) {
if (data.ErrorMessage != '') {
alert(data.ErrorMessage);
}
else if (data.RedirectUrl != '') {
CloseDialog();
window.location = data.RedirectUrl;
}
}
我还尝试使用 jquery.form 插件进行 ajax 发布,但随后您将看到 formdata(一个 fckeditor)位于初始值中(看起来像是被缓存了)。
I'm trying to submit a form who is rendered in a SimpleModal dialog, but my submit is never called when I'm using FF3 & Opera (Chrome, Safari and IE works). I use the following code:
function ShowModal(rendercontainerid, modalcontainerid, url) {
if (url == '')
return;
$.get(url, function(data) {
$(rendercontainerid).html(data);
$(rendercontainerid).modal({
close: false,
containerId: modalcontainerid,
onOpen: function(dialog) {
dialog.overlay.fadeIn('slow', function() {
dialog.container.slideDown('slow', function() {
dialog.data.fadeIn('slow');
});
});
},
onClose: function(dialog) {
dialog.data.fadeOut('slow', function() {
dialog.container.slideUp('slow', function() {
dialog.overlay.fadeOut('slow', function() {
$.modal.close(); // must call this!
});
});
});
}
});
});
}
function CloseDialog() {
$.modal.close();
}
function SubmitAndClose(rendercontainerid) {
$(rendercontainerid).find('form').submit();
CloseDialog();
window.location = window.location;
}
function AjaxSubmitAndClose(rendercontainerid) {
var form = $(rendercontainerid).find('form');
var url = $(form).attr('action');
var postData = $(form).serializeArray();
var options = {
dataType: 'json',
success: AjaxSubmitSucces
};
$(form).ajaxSubmit(options);
}
function AjaxSubmitSucces(data) {
if (data.ErrorMessage != '') {
alert(data.ErrorMessage);
}
else if (data.RedirectUrl != '') {
CloseDialog();
window.location = data.RedirectUrl;
}
}
I also tried to the jquery.form plugin for ajax posting but then you will see the formdata(An fckeditor) is in the initial values(it looks like it is cached).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 onShow 回调:
Try using the onShow callback: