Solved

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

Posted on 2011-09-21
6
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

630 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