我试图提交一个在SimpleModal对话框中呈现的表单,但当我使用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发布,但是你会看到表单数据(一个fckeditor)在初始值中(看起来像是被缓存了)。