Jump to content

jQuery: .load() issue


rklockner

Recommended Posts

I have a page that contains 15 tabs.  When each tab is pressed, it calls a function that uses .load() to load that tab.  In my initial testing, all seems to go smoothly (loading in less than a second).  However, once you click about 10 tabs, the pages start to load slower, and by click 13, it takes more than 30 seconds to load.

 

If you refresh the page this process starts over and the outcome is the same (by click 12-13 it is unusable).

 

Below is the code.  FYI the reload_timer was an attempt to reload the page if the query was taking more than 10 seconds... It didn't work.  I left it in for feedback in case I don't find a suitable solution to the actual issue.

 

<a onclick="getNewPage('page_name', this, 'co_applicant');" >Co-Applicant</a>

 

<div id="result_container"></div

 

 

<script>

 

function getNewPage(newpage, el, tab){

  var reload_timer = setTimeout('window.location.reload()', 10000);

  $('#lead_content').html('<p>Data Loading: <img src="images/ajax-loader-2.gif" width="220" height="19" /></p>');

 

  $('#result_container').load(newpage+".php?leadid=<?=$leadid?>new_tab="+tab, function(){

  clearTimeout(reload_timer);

  });

  $('a').attr('class', '');

  el.className = 'selected';

 

}

 

</script>

Link to comment
https://forums.phpfreaks.com/topic/253561-jquery-load-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.