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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:43:23+00:00 2026-06-15T19:43:23+00:00

I got an Ajax function that looks like this function PersonAtlLawUpdate(personRef) { var selectionPanel

  • 0

I got an Ajax function that looks like this

function PersonAtlLawUpdate(personRef) {
var selectionPanel = $('div#SelectionPanel');
var fromdate = selectionPanel.find('input#FromDateTextBox')[0].defaultValue;
var timeSpan = selectionPanel.find('select#TimeSpanDropdownList').data('timespanvalue');
var url = "MonthOverview.aspx/OnePersonAtlLawUpdate";
$.ajax({
    url: url,
    data: JSON.stringify({ personRef: personRef, fromdate: fromdate, timespan: timeSpan }),
    type: "POST",
    contentType: "application/json",
    dataType: "JSON",
    context: document.body,
    success: function (atlError) {
        changePersonAtlStatusIcon(atlError, personRef);
    },
    error: function (xhr, status, errorThrown) {
        //alert(errorThrown + '\n' + status + '\n' + xhr.statusText);
    }
});

}

In one function I need to run this twice like this:

    PersonAtlLawUpdate($(gMarkedCell).parent("tr").attr("personref"));
    PersonAtlLawUpdate(pRef);

The problem that can be is that in some cases doesn’t work 100%. The dom doesnt update in one of the functions. And I think it is because the other one “overwrites” it.

So how do I make sure that the second “PersonAtlLawUpdate” runs after the first one completes? Doesnt seems good to put a delay on it. And is it a good solution to set async to false in the ajax call?

EDIT,
tride like this and placed a console.log in my success. But “all complete” will run first of them:

$.when(PersonAtlLawUpdate($(gMarkedCell).parent("tr").attr("personref")), PersonAtlLawUpdate(pRef)).then(function (){console.log("all complete")});
  • 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-15T19:43:25+00:00Added an answer on June 15, 2026 at 7:43 pm

    You can just use a callback function so that it executes right after the first one has executed:

    PersonAtlLawUpdate($(gMarkedCell).parent("tr").attr("personref"), function(){
      PersonAtlLawUpdate(pRef);
    });
    

    Or maybe you can rethink the problem, and come up with a solution that doesn’t require calling the same function twice. Maybe you don’t really need to do this.

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

Sidebar

Related Questions

Possible Duplicate: $.ajax context option I've got some code that looks like this: $.post(self.baseUrl
I did ajax call and got response in callback function like below: var v=;
Good day, I've got WebMethod that looks a bit like this... [WebMethod] public static
I've got a bunch of Ajax links in a menu that reload a div
I've got a screen that looks as follows: The tabs get loaded via ajax
I've got a an AJAX page request that uses a php file designed to
Update: Got this working by disabling CodeIgniter Profiler which was interfering with the Ajax
I've got a WebMethod that I'm calling from jQuery AJAX. No matter what I
I've got a page that contains multiple links. These links should do an ajax
I've got an ajax call via jquery that executes without error until I get

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.