Improve company productivity with a Business Account.Sign Up

x
?
Solved

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

Posted on 2011-09-21
6
Medium Priority
?
243 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

589 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