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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:45:30+00:00 2026-06-18T00:45:30+00:00

I received a suggestion from a prior question that I need to amend my

  • 0

I received a suggestion from a prior question that I need to amend my code chain a series of POST requests together, but I don’t have any idea how to accomplish this. Specifically, the advice I was given was to:

fire off a post, have its success handler fire off the next post,
etc… and then when all the posts are done, the final post’s success
handler fires off the get

This strategy makes sense to me but I do not know how to implement. I am trying to prevent the call to GET before all of the calls to POST have completed. Currently, I have implemented $.when.apply to delay the sending of GET. Here is the code for that:

function(){ 
$.when.apply(undefined, InsertTheAPPs()).done(function () {
$.ajax({
url: sURL + "fileappeal/send_apps_email",
success: function() {  
    var m = $.msg("my message",
    {header:'my header', live:10000});
    setTimeout(function(){
        if(m)m.setBody('...my other message.');             
    },3000);
    setTimeout(function(){
        if(m)m.close(function(){
              window.location.replace(sURL+'client/view');
        });
    },6000);
    $('#ajaxShield').fadeOut(1000);},
error: function(){
    $.msg("error message",
    {header:'error header', live:10000});
    }
}); 
}); 
}

Here is the code for the jQuery $.each loop. This is the code that needs to not only begin, but must end before the ajax call to fileappeal/send_apps_email above:

function InsertTheAPPs(){
$('input[name=c_maybe].c_box').each(function(){         
    var jqxhrs = [];
    if($(this).prop('checked')){ 
        var rn = $(this).prop('value'); 
        jqxhrs.push(
            $.ajax({
            url: sURL + 'fileappeal/insert_app',
            type:"POST",
            dataType: 'text',
            data: {'rn': rn},
            error: function(data) {console.log('Error:'+rn+'_'+data);}
            })
        )
    return jqxhrs;
    } 
}); 
}

Could someone demonstrate how I can modify the code above to implement the strategy of chaining together the multiple POST calls?

  • 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-18T00:45:31+00:00Added an answer on June 18, 2026 at 12:45 am

    Don’t return from .each. It doesn’t work that way. Instead do this:

    var jqxhrs = [];
    $(...).each(...
    });
    return jqxhrs;
    

    Nothing is assigned to the return value of .each, which you can’t get anyway. Returning from each allows it to be used like break/continue, which doesn’t make sense in your context.

    Moreover, the var jqxhrs inside of the each loop causes a new variable to be declared in that context on each iteration of the loop.

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

Sidebar

Related Questions

Regarding this question I had research lot and got the different suggestion, but non
I need to create DTOs from NHibernate POCO objects. The problem is that the
thanks to the suggestions I received here , I cleaned up my code and
I need suggestion about YAMI library . I have a system which receives Json
I received an e-mail which contained a link that looked like it was to
I received a list of numbers in Custom format (Type: 000000) that represent military
I received a demand to correct a ASP website that have lots of functions
I received this error on following code.Is this + sign is not available in
Had received a module from CCAVENUE and it was working fine with Magento 1.6.2...
I received DateTime String from Fedex in following format 2012-06-22T21:39:48-05:00 I want to convert

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.