我有一个Fancybox窗体(iframe)。当用户提交表单时,我会刷新父页面。但是,如果用户决定关闭Fancybox表单而不提交,则父页面的刷新仍在进行。Fancybox,提交后只刷新父页面,但没有关闭
这是我看中的框代码:
<script language="JavaScript">
$(document).ready(function() {
$(".edit_product").fancybox({
autoScale : true,
fitToView : false,
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',
title : '',
type : 'iframe',
afterClose : function() {
parent.location.reload(true);
}
});
});
</script>
这是提交代码:
<script type="text/javascript"> //EDIT PRODUCT
$(document).ready(function() {
var options = {
target: '',
dataType: 'html',
beforeSubmit: showRequest_editprod,
success: showResponse_editprod
};
$(".edit_product_div").delegate("#edit_product_form","submit",function() {
$("#edit_product_loading").show(500);
$(this).ajaxSubmit(options);
return false;
});
});
function showRequest_editprod(formData, jqForm, options){
return true;
}
function showResponse_editprod(responseText, statusText, xhr, $form){
parent.jQuery.fancybox.close();
}
</script>
有没有一种办法后,才提交刷新父页面,如果用户点击在Fancybox的“x”或外部,它只是关闭花式框而不刷新?
谢谢。
删除线也将从表格后重装停止父页面提交。 – DanielOlivasJr
你可以在'submit'函数中写入这个代码而不是'onclose'。 –
让我看看你的提交代码。 –