douzen1880 2015-03-19 10:54
浏览 308

提交后刷新整个页面(Fancybox)

I have a page where the user will click the button then a fancybox popup will appear and in there is a php file that has all the fields you can update. What I want to happen is that after I press the update button the whole page will refresh and will close the popup. But what's happening is that after I press update only the popup refreshes. How could I do that?

in this page is where I echo all of the user info

emp_refer.php

       <a id="various5" href="http://i-refer.elitebpocareers.com/refer/updateInfo.php">
                    <button class="button">Edit Personal Information</button>
                </a>


        <SCRIPT TYPE = "text/javascript">

        $("#various5").fancybox({
         'width'             : '75%',
         'height'            : '75%',
         'autoScale'         : false,
         'transitionIn'      : 'none',
         'transitionOut'     : 'none',
         'type'              : 'iframe'
        });

        </SCRIPT>

Then in the page 2 after the update I do this code and the popup only refreshes

echo "<meta http-equiv='refresh' content='0; url=emp_refer.php'>";
  • 写回答

1条回答 默认 最新

  • doucai4274 2015-03-20 04:03
    关注

    What you could do is :

    In page 2, after the update run the fancybox.close() method instead of the meta tag like :

    echo "<script>parent.jQuery.fancybox.close();</script>";
    

    Then, in your fancybox initialization script (emp_refer.php page) add the onClosed callback to your API options and run location.reload() within it like :

    $("#various5").fancybox({
        'width': '75%',
        'height': '75%',
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'type': 'iframe',
        'onClosed': function () {
            location.reload();
            return;
        }
    });
    

    NOTE: if you are using fancybox v2.x use the afterClose callback

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?