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 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

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

How would you access the cache from a jQuery ajax call? I'm using jquery
I have a table style page with rows. Each row has a checkbox. I
I have a variety of image sets that I'm displaying on a web page
Having a bit of a hairy issue when submitting data over a jquery ajax

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.