Solved

Unloading a page with a lot of data in IE crashes using jQuery

Posted on 2011-09-21
6
226 Views
Last Modified: 2012-08-13
I have a GUI I developed that displays reports of various kinds. The reports are loaded in using the $.ajax function of jQuery and are unloaded with a jQuery script that empties the div that the report was in and replaces it with the menu list of all reports. When a menu item is clicked on, again the $.ajax function loads in the report and removes the menu.

This functioning works great in both Firefox and IE8, except for one report which is larger than most of the others (about 20,000+ cells of data), when unloading it crashes IE8. In fact, after clicking the tab to unload the report, nothing happens for about 10 seconds at which point in time a window pops up stating "Stop running this script? A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer might become unresponsive."  If I click "yes" (i.e. stop running this script) IE freezes. If I click "No" the popup freezes for about 10 seconds and then refreshes with the same message.

This particular report can also be rendered with less data and when that is the case it works fine on unloading. I am really stymied as to what the problem. I've tried all sorts of changes to fix it and I have had no luck.

Below is the jQuery script which unloads the reports.
/*CLICKING ON THE CATEGORY BREAD CRUMBS TAB RETURNS TO THAT MENU*/
	$('#bc_page a').live("click",function() {
		$('#bc_page').prepend('<img src="images/ajax-loader3.gif" id="menu_gif"/>');
/*		$('#prod_page').empty();
*/		$('#new_page').empty();
		$('#bc_report').delay(100).slideUp(500);
		$('#bc_page a').css('color','#CA0000');		
		var area = $(this).text();
		var space = area.indexOf(" ");
		if (space != -1){
			area = area.replace(" ", "-");
			}
		
		$('#new_page').delay(500).load("product_page.php?p=" + area);
		$('#prod_page').css('text-align','left');
		$('#menu_gif').fadeOut(400, function() {
			$(this).remove();
		});
		var Size = $('div.footer').height();
		togFooter(Size);
	});

Open in new window


$('#new_page') is the div that contains the menu or the reports.

I'm hoping someone can maybe spot something about this script that is odd.
0
Comment
Question by:denewey
  • 4
6 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 36577067
Change line 16 - 18 to:

$('#menu_gif').remove();

That fadeOut() makes delays and that does cost performance.

The line 6 is also a candidate for slow down: slideUp() make multiple copies of your data.

0
 

Author Comment

by:denewey
ID: 36580487
Thank you, but the script never gets to line 16 when it hangs up. That piece of code removes the small gif that spins while the script is doing it's main work. That doesn't come until after the report is removed and the script hangs up before the report is removed. Also the slideUp is on a 1" X 3/4" little tab. I highly doubt that is slowing down the script.
0
 
LVL 15

Expert Comment

by:SRigney
ID: 36600969
What version of jQuery are you using?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:denewey
ID: 36601858
jquery-1.5.1.min.js
jquery-ui-1.8.14.custom.min.js
0
 

Accepted Solution

by:
denewey earned 0 total points
ID: 38251798
This problem was solved by loading the report directly without the full dataset. When additional data is desired the user clicks on a link which opens new rows which are populated by an AJAX call. So, when leaving the report I am no longer depending on a jQuery script to unload the page, but rather just going to a new page.
0
 

Author Closing Comment

by:denewey
ID: 38265553
The couple of solutions proposed by the expert didn't address the core problem and no other solutions were proposed. My solution as explained in my last post solved it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now