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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:41:08+00:00 2026-05-11T12:41:08+00:00

I have a jQuery .ajax call: $j.ajax({ type: POST, url: /Services/Cart.asmx/UpdateQuantity, data: data, contentType:

  • 0

I have a jQuery .ajax call:

$j.ajax({     type: 'POST',     url: '/Services/Cart.asmx/UpdateQuantity',     data: data,     contentType: 'application/json; charset=utf-8',     dataType: 'json',     success: function(msg) {         var d = msg.d;         // etc.     },     error: function(xhr, msg) {         var response = JSON.parse(xhr.responseText);         var cart = $j('#cart');         if (response.Message) {             cart.before('<div class='error'>' + response.Message + '</div>');         } else {             cart.before(' <div class='error'>An unexpected error occurred.</div> ');         }     },     complete: function(request, settings) {         // Some other stuff.     }  }); // end ajax alert('Initially thought this would be called after above .ajax call complete. But it is not. Rather, it is called before success etc.'); 

However, based on some data returned by this first ajax call, I want to initiate a second .ajax call. It appears though that due to how the callbacks are configured for the first one, it doesn’t occur sequentially (i.e. where in the above the last alert(‘Initially…’) line) so I’m not able to use the latest updated client-side DOM data.

How is it best to send off another .ajax call? I quickly did some tests within the complete event, but that didn’t seem to be a go.

I’ve got ‘jQuery in Action’ sitting here waiting for me to find time to dig through it to understand more of what’s going on under the hood, but no time yet!

UPDATE: Erk. When the obvious doesn’t first work as expected, the problem usually lies between the chair and the monitor; I’ll put this one up to an all-nighter brain fart. Turns out how I originally had it set up (calling the second .ajax call within the success callback) was very obviously correct, but my second .ajax call had a small syntax error in it (and thus failed and sent me off the wrong way).

And @kgiannakakis gets noted as the answer because he/she was a) first and b) provided the hilariously understated ‘You can configure the call to be synchronous, but this is not a recommended technique.’

  • 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. 2026-05-11T12:41:08+00:00Added an answer on May 11, 2026 at 12:41 pm

    Well the alert should go in the success callback and not after the ajax call. The default behaviour of ajax calls is asynchronous. That is, the call returns immediately and the callbacks are called at some point later at time, when the data are actually received.

    You can configure the call to be synchronous, but this is not a recommended technique.

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

Sidebar

Related Questions

I have the following jQuery Ajax call: $.ajax({ type: POST, url: addtobasket.php, data: sid=<?=
Let's say I have the following jQuery AJAX call: $.ajax({ type: POST, url: MyUrl,
I have this simple jQuery ajax post to a Pyramid webapp. Ajax call: $.ajax({
I have an issue I have this jQuery code: $(document).ready(function(){ $(#follow).click(function(){ $.ajax({ type: 'POST',
I am running ASP.NET MVC Beta. I have an AJAX call running through jQuery
I have a form that uses jQuery to submit an ajax post and it
I have a jquery Ajax call function that I use to submit form to
I have the following 2 jQuery Ajax calls. The first is a call to
I'm having some trouble getting jquery to post some json data to a rest
I have a situation where I send jquery ajax post request but in my

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.