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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:41:57+00:00 2026-06-17T05:41:57+00:00

I have a code having following structure. Basically my requirement is that onChange of

  • 0

I have a code having following structure. Basically my requirement is that onChange of option in “SELECT” f5 should run followed by f1.
And inside f1 – first f2 must run and when done then f3 must run. Completion of f2 means it also must ensure that f4 is run and completed.
I mean to have the flow maintained because if some function to be finished earlier is left behind then my whole program becomes waste.
I guess deferred has the solution hence I tried using it with pipe. But as I am not well versed in maintaining this flow I am not able to get my expected results.
Please help if you can.

<script>
function f1(){
   function f2(){
      ....
      f4();
      ....
   }
   function f3(){
      ....
   }
}

function f4(){}
function f5(){}
</script>
 ....
<select onChange=f5().pipe(f1) >
......
</select>
  • 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-17T05:41:58+00:00Added an answer on June 17, 2026 at 5:41 am

    Edit: It seems you’re using $.ajax in the functions. If you want something to run after an AJAX query is complete, you can set it as a callback to be run when the query returns. For example, you can define f2 in terms of other functions, as such:

    function f2()
    {
        g();
        f4();
        h();
    }
    

    If f4 uses AJAX, you could change the definition as follows:

    function f2()
    {
        g();
        f4();
    }
    function f4()
    {
        $.ajax("http://url.com").done(function(){
                h();
                f3();
            });
    }
    

    The done() function allows you to set one function (in this case it’s an anonymous one) to execute as soon as the query is successfully returned. With f2 defined this way, you don’t need f1 any more, so you can define another function

    function f6()
    {
        f5();
        f2();
    }
    

    Then you can change the onChange event to

    <select onChange="f6()"></select>
    

    Also note that, as mattmanser posted, this code: function f(){} only defines a function, it doesn’t run it. If you’d like the function to be executed immediately after it is defined, you can use a closure instead.

    (function f ()
    {
    
    })()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an issue with rails involving javascript. Basically, I have the following code:
I am having a link <a id=test href=text.php>test</a> I have the following jquery code
I have some jQuery code that is having difficulty running because I'm using it
If I have pages having server-side code in code-behind, then I know that the
I have a Python project that has the following structure: package1 class.py class2.py ...
I have a set of XSD files each having the following structure: message_i.xsd <xs:complexType
Dear competent people. I'm having a problem with the following code, specifically that the
Having the following structure: <td class=padding_right padding_left>Neighborhood</td> <td> <div id=neighborhoods_region> <select class=inputs_form_data id=neighborhood_id2 name=neighborhood_id2>
I have the following structure that is defined in a header file for a
I have a C code that works in the following way: the header contains

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.