JQuery Loop -- "Too Much Recursion" Error
Posted: Mon Jun 01, 2009 2:39 pm
I am currently using jQuery to pull a random quote from a database via AJAX and display it at the top of my website.
The trouble is, if I allow the website to sit for a while, it eventually starts throwing off "Too Much Recursion" errors and the web browser bogs down.
I assume that there is a proper way to set up a nice loop in Javascript without memory leaks, but I'm at a loss. Can anyone offer a suggestion?
Code: Select all
function refreshQuote() {
setTimeout("refreshQuote()", 7000);
$("#Quote").hide("slow", function() {
$(this).load("/quote/random/").ajaxComplete(function() {
$(this).show("slow");
});
}
}I assume that there is a proper way to set up a nice loop in Javascript without memory leaks, but I'm at a loss. Can anyone offer a suggestion?