我有 3 页,main_page.php
即ajx_page1.php
ajx_page2.php
我正在使用$.post
请求main_page.php
并发送到ajx_page1.php
. 在此ajx_page1.php
发送$.post
请求之后ajx_page2.php
。我在下面添加了一张图片以便更好地理解......
问题
该请求在我的本地主机上运行良好且快速,当我在实时服务器上运行它时,它需要将近 4-6 秒的时间。这是最可怕的时间流逝。
是否有任何其他方法可以将页面内的 ajax 请求发布到子页面,如下图所示。
并且还ajx_page2.php
从数据库中检索数据.. 并且其他页面正在从他们的 ajx-child 页面中提取数据
甚至 CSS 和 jQuery 都不起作用..
代码
Main_page.php
$.post("ajx_page1.php", {parameters}, function(return_data){
$("#container").html(return_data);
});
ajx_page1.php
$.post("ajx_page1.php", {parameters}, function(return_data){
$("body").html(return_data);
});
ajx_page2.php
`some condition and logical data from database`
更新文件详细信息
Main_page.php
<div id="content_region" class="center">
<div class="a_job_pre_action clear">
<ul class="a_jj_ul">
<li class="j_act_1 j_act" ><a href="" >JOB DETAIL</a> </li>
<li class="j_act_2 j_act" ><a href="" >STAFF SHORTLISTED</a> </li>
<li class="j_act_3 j_act" ><a href="" >CLIENT SHORTLISTED</a> </li>
<li class="j_act_4 j_act" ><a href="">CONFIRM FOR INTERVIEW</a> </li>
<?php if ($_SESSION['user_type'] == "admin" or $_SESSION['user_type'] == "manager"): ?>
<li class="j_act_5 j_act" ><a href="" >INVOICES</a> </li>
<?php endif; ?>
<li class="j_act_6 j_act" ><a href="" >CONTACT CLIENT</a> </li>
</ul> <!-- a_jj_ul -->
</div> <!-- a_job_pre_action -->
<div class="clear a_job_action_result">
</div>
<script>
$(document).ready(function(){
$(".j_act_1 a").click(function(){
$.post("ajx_page1.php", {job_id : j_job_id}, function(return_data32){
$(".a_job_action_result").html(return_data32);
});
});
});
</script>
ajx_page1.php
<select class="a_sel" name="sel_staff">
<?php get_all_staff_options(); ?>
</select>
// and some other data too.
<script>
$(document).ready(function(){
$(".ajx_select_status").change(function(){
var j_job_status = $(this).val();
var j_job_code = "<?php echo $curr_job_data['job_code']; ?>";
$.post("ajx_page.php", {job_status : j_job_status, job_code : j_job_code}, function(return_data32){
alert(return_data32);
});
});
});
</script>
ajx_page2.php
full pure php code here