Solved

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

Posted on 2011-09-21
6
231 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jquery tab header text 1 23
JavaScript to set default value on SharePoint form field 7 20
Html value of radio 14 29
AJAX Wordpress Not Reading Variable 2 28
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

829 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