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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.