Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 519635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:03:42+00:00 2026-05-13T08:03:42+00:00

function load_result() { $.getJSON( http://somesite.com/loadresult.php, function(data) { if( data == undefined || data ==

  • 0
function load_result()
{
    $.getJSON( "http://somesite.com/loadresult.php", function(data) {
        if( data == undefined || data == null )
        {
            console.log( "no data" );
            clearTimeout( lr_timeout );
            lr_timeout = setTimeout( "load_result()", 2000 );
            return;
        }
        insert_result_price( data );
        clearTimeout( lr_timeout );
        lr_timeout = setTimeout( "load_result()", 50 * ( Math.random() * 10 ) );

    } );
}

and lr_timeout is defined globally and the load_result function is kicked off initially in the document.ready function. The problem is that the function doesn’t always run. I’ll watch it in Firebug and I have another function that’s set on a setInterval that always works.

Ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:03:42+00:00Added an answer on May 13, 2026 at 8:03 am

    Is your other setTimeout function (the one that always works) also inside a $.getJSON? If so, does it call it on the same URL (http://somesite.com/loadresult.php in your example, but I’m sure it’s different in real life)?

    It’s possible that http://somesite.com/loadresult.php is a flaky resource, and your inconsistent results are due to that resource, not setTimeout. Of course, if they’re both using that same resource, then that couldn’t be the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code snippet: $.getJSON(http://localhost:8080/images, function(data) { var items = []; $.each(data,
During a document.ready, I call the load_result function outlined below: function load_result() { $.getJSON(
<script type=text/javascript> $(document).ready(function() { $(a).click(function() { $(#results).load( jquery-routing.php, { pageNo: $(this).text(), sortBy: $(#sortBy).val()} );
I'm using the .load() function in jquery to insert the results of a php
I have a data-upload function that load some data into several tables and processes
After loading a PHP template (using jQuery's load function), this simple script won't make
I'm using the Jquery load function $('#result').load('test.php'); to load a page into another page
I have a function Load() in a js file which I added to the
I have a function to load a html part into a element in main
I'm using the .load() function to load a section of html that has some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.