0

I using Jquery framework Jquery-1.3.2.js ,
when I calling user defined function in every time interval ( about 5 seconds )

then I getting popup error message : "A script on this page may be busy or it may have stopped responding . You can stop the script now, open the script in debugger, or let the script continue"

error from script Jquery-1.3.2.js I used function as below

function getMore()
{
    $.ajax({
        type: "POST",
        url: "Service/getList.asmx",
        data: "{ }",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) 
        {
            if(msg  != null)
            {
                if(msg  != null)
                {
                    var dynDiv = document.createElement("div");
                    dynDiv.id = "divDyna";
                    dynDiv.innerHTML = msg;
                    document.getElementById('Div1').appendChild(dynDiv);
                    $('div#Div1').slideDown();   
                }              
            }
        }        
    });     
} 

How I can solve it or handle error ( if possible in try catch ) ?

see the attached screen shot alt text.

2
  • 1
    In this case this error occurs either when you keep calling setInterval by mistake thus pilling up a process after a process. Or it falls in an infite loop. Or the results are delivered slower than are being asked again. Jan 20, 2011 at 13:54
  • Hello @elasticrash , I am not used set interval function.. When I scrolled window then I calling my function for getting new list from my database and rendered it on the page. in between sometime I getting that error message about stop working Jquery.. - Thanks Abhi. Jan 20, 2011 at 14:22

2 Answers 2

0

Maybe the problem is related to calling this function too many times in a row, even when some of the calls are not ready yet. One solution is to call getMore() to get more than 1 record at a time, for example 5 records.

Facebook does this in the NewsFeed at the end of the page automatically, but it gets like 10 records.

1
  • I get 20 record when I scrolling down I set get 20 records. user moved scrolling down fast then sometime it getting error message as shown above.. stop script. Aug 3, 2011 at 4:32
0

This happen when your script takes longer time to execute. You can increase the allowed time for script execution in firefox. you can refer [this]: https://support.mozilla.org/en-US/kb/warning-unresponsive-script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.