使用AJAX加载MYsql查询

My website take long respond to load,it is create on Cake PHP.

In my site there is 7 MySql query, when i load the page,7 querys run so it take 5 seconds to 18 seconds and then sever send response in HTML format to browser, and then full page show with in 0.5s. i mean suddenly full page show. ,

my page have five section like header, menu bar, content, side bar and footer,

is this possible that every section load one by one, its look like, when new visitor come, so page response is like that, first head show, then menu, then context, then side bar and at the end footer show.

My domain speed is very fast, my admin panel open in 1 sec, but pages are take long time, so thats why i want to do this, My admin panel is fast but pages take long time to send First Byte.

here is simple code,

<body>
<div class="container">

<?php include("head.php"); ?>

<?php include("menu.php"); ?>

<?php include("content.php"); ?>

<?php include("side_bar.php"); ?>

<?php include("footer.php"); ?>
</div>
</body>

how can i do this, first head.php page and its Mysql query run and server response show in browser

then second part menu.php page and its Mysql query run and server response show in browser,

all other pages that i include in <body> run one by one and result show on browser

so with this decnique visitor wait less,

how can i use AJAX here or and other technique?

Please guide me, may be this technique decrease page load time and First byte response.

thank you

查看全部
weixin_33698823
weixin_33698823
2013/10/01 09:48
  • php
  • html
  • mysql
  • ajax
  • 点赞
  • 收藏
  • 回答
    私信

1个回复