简体   繁体   中英

how to load php page after loading all the other content of page

I am developing an web based video channel where I have to add mailing functionality. I have added a mail button, all the functionality is working fine, but it is taking more time to load the page. I have included mail.php in the video.php page. Whole page wait until mail.php is included. Hence it is taking more time.

Note my application is developed in PHP codeigniter. mail.php contain some js file,ajax call,and html form.

Can i do something to load all the page content first then at last load mail.php in background.

here what i tried...

video.php

<script>jQuery("#mail_btn").click(function()jQuery("#div1").load(mail.php);});</script>
<div id="div1" class ="mail_form">
//include_once(mail.php); //it was working fine but it takes time,i want to load mail form here.
</div>

please help me or suggest any alternative way. Thanks..

I would add the jQuery lazy load plugin http://jquery.eisbehr.de/lazy/ . I added a snippet below but there are better examples on the plugin site.

 $(function() { $("div[data-src]").Lazy(); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazy/1.7.1/jquery.lazy.min.js"></script> <script type="text/javascript" src="//cdn.jsdelivr.net/jquery.lazy/1.7.1/plugins/jquery.lazy.ajax.min.js"></script> <div data-loader="ajax" data-src="ajax.html"> <p>Content you want to load later goes here.</p> </div> 

我认为您可以使用Ob_startob_end_flush这些功能来控制页面输出加载和显示,请在此处查看手册

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM