I have 3 pages ie main_page.php
, ajx_page1.php
and ajx_page2.php
And I am using $.post
request in main_page.php
and sent to ajx_page1.php
. After this ajx_page1.php
send $.post
request to ajx_page2.php
. And i have added an image below for better understanding...
Problem
The request are working good and fast on my localhost, and when i run this on live server it taking almost 4-6 seconds of time. And this is most horrible time lapse.
Is there any other method for posting a ajax request within a page to child-child pages as shown in images below.
And also ajx_page2.php
retrieve the data from database.. and and other pages are pulling data from their ajx-child pages
Even CSS and jQuery are not working..
Code
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`
Updated file details
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