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 8378871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:01:50+00:00 2026-06-09T16:01:50+00:00

Here I found an example of the loop(recursive function) delay and used for its

  • 0

Here I found an example of the loop(recursive function) delay and used for its own purposes. The problem is that with the successful addition of div I need to stop the cycle, but here is recursive function and so break throws an error.

I tried something like this:

(function myLoop(i){
    console.log($("input[name='show']").is(':visible'));
    if($("input[name='show']").is(':visible'))
        return false;
    setTimeout(function(){
        $.getScript('index.php?ping=true', function(data){
            if(ping){
                $('#input').append('<input width="320" type="image" height="240" border="0" src="http://'+url+':'+port+'/?up" name="show">');
            }
        });
        if (--i) myLoop(i);
    }, 7000)
})(10);

But it stops only after second div is added. as I understand I need to somehow use the callback on if?

enter image description here

UPDATE:
Solved the problem myself, just added if (–i) myLoop(i); to the getscript

  • 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-06-09T16:01:51+00:00Added an answer on June 9, 2026 at 4:01 pm

    You need to store a reference to your setTimeout and the use clearTimeout.

    var timeout = setTimeout(function(){
        if (success) {
            clearTimeout(timeout); 
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the example found here: http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_01 The issue is that when I specify
I'm trying to follow the Auth example for Webapp2 that can be found here:
I found some struct initialization code yesterday that threw me for a loop. Here's
I'm so close! I'm using the XNA Game State Management example found here and
I found an example here to create a select list with optgroups using KnockoutJS.
I am using the jQuery spinner tool found here: http://btburnett.com/spinner/example/example.html When I try using
I found a great C++/ODBC example here ... The project I downloaded builds great
I found how to fix div position using jQuery. Here is an example .
I've been looking into faceted search with Lucene.NET, I've found a brilliant example here
The example to demonstrate the issue can be found here: link text The test

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.