原里
1、利用if
2、在自定义success、error跳转的页面中获取提示信息传到父级表单页面的js上接收
实现过程
在全局都都调用到的html公共地方放个隐藏的if
<!-- 让表单提交不刷新,模拟异步体验 -->
<div id="alert_message" style="display:none">
<iframe name=iframe_form id="ifr" scrolling="no"></iframe>
</div>
在全局都都调用到的html公共地方放个js函数,专门接收提示信息、弹窗、跳转的工作 //接收ifram页面返回的消息
function iframe_form_msg(code, msg, url = ''){
//这里简单弹窗,想要其他效果可以用其他插件弹窗
alert(msg)
if(code == 1){
setTimeout(function(){
location.href = url;
}, 1000);
}
}
在自定义success、error跳转的页面中加入执行父级js函数的代码 if(typeof(parent.iframe_form_msg) == 'function'){
parent.iframe_form_msg("{$code}", "<?php echo(strip_tags($msg));?>", '{$url}');
return false;
}
最终:在需要操作的form表单上加个target="if
以上就是那么简单,应该能解决你们的男题了,不懂的记得q我714142307,我很乐意解说...................嘎嘎
最佳答案
