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

  • Home
  • SEARCH
  • 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 8664555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:16:08+00:00 2026-06-12T17:16:08+00:00

Is it possible? How to do this? When clicking on a button, I call

  • 0

Is it possible? How to do this? When clicking on a button, I call function1. If the condition is true (i==1), the function1 pauses and the following code will only be executed after function2 is totally executed. Example:

function1(i){
    //some code here
    if(i == 1){
        function2(i);  // call function2 and waits the return to continue
    }
    //the following code
}

function2(i){
    //do something here and returns
}
  • 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-12T17:16:09+00:00Added an answer on June 12, 2026 at 5:16 pm

    Here you go:

    function1(i){
        //some code here
        if(i == 1){
            function2(i);  // call function2 and waits the return to continue
        }
        //the following code
    }
    
    function2(i){
        //do something here and returns
    }
    

    In case you meant that function2 is actually async in some manner:

    function1(i){
        //some code here
        if(i == 1){
            // call function2 and waits for return to continue
            function2(i, function() {
                // the following code
            });  
        }
        else {
            //the following code
        }
    }
    
    function2(i, callback){
        //do something async here and return when complete
        setTimeout(callback, 1000);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: presentViewController: crash on iOS 6 (AutoLayout) I'm getting this error when clicking
Is this possible? My code works on Firefox. I can also get webkit to
Is this possible at all? The idea is to have the following: if ($some_statement)
Amazon has the button that opens an app as follows. http://img836.imageshack.us/img836/6829/screenshot20100724at111.png Clicking this button
In my main page, I have to call a colorbox upon clicking a button.
Is this possible to use Ajax.Beginform with update target inside of ajax form. like
Is this possible if I click on an anchor link to simulate as if
Is this possible? function testObj(testArg) { //Do obj stuff here } testObj.prototype.addFn = function()
Is this possible? I know how to do it from your own wall but
Is this possible to do? I want to ping or send some kind of

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.