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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:34:23+00:00 2026-06-03T06:34:23+00:00

This may be a problem somewhere else in my code, but I hope there’s

  • 0

This may be a problem somewhere else in my code, but I hope there’s a clue here.

I’m using a jQuery AJAX call to update my MySQL database, and then another one to read the database and update a table on my page. My problem is that I update the database correctly, but my second AJAX call (wrapped in a function) is returning the old data. But if I fire the function again, it works perfectly.

Here’s the first AJAX call:

$.ajax ({
cache: false,                   
type:   'POST',     
url:    'qry_creats_record.php',
data:   {   
        equipID : $('#equip_id').val(),
        dateSent : $('#txt_to_repair').val(),
        organization : $('#organization').val(),
        success: function() {
        ServiceTable($('#equip_id').val());   <--CALLS SECOND FUNCTION                  
        }
    }           
}); 

Works great, updates the database perfectly. Then I want to update the page with this function (called in the ‘Success’ part of my first call):

function ServiceTable(equipID) {
  var serviceRecords = $.ajax ({
  cache: false,                 
  type: 'POST',
  url: 'qry_show_repairs_table.php',
  async: false,
  data: {  equip_id : equipID   
        },
    success: function() {
      return data;
    }
}).responseText;
$('#serviceRecordsTable').html(serviceRecords);     
}

The second function works great as well, updates the page element ‘serviceRecordsTable’ if I call it from a button. But when I call it from the ‘Success’ part of the first call, it returns the old, non-updated data. I put an ‘alert’ box in my second function to see what was going on, and it confirms that the function is really seeing the old, pre-updated data from my database. But if I activate the second function from a button on the page, the second function refreshes my page with the new data.

Really stuck. Any help is appreciated.

  • 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-03T06:34:24+00:00Added an answer on June 3, 2026 at 6:34 am

    Try like this –

    $.ajax ({
    cache: false,                   
    type:   'POST', 
    url:    'qry_creats_record.php',
    data:   {   
          equipID : $('#equip_id').val(),
         dateSent : $('#txt_to_repair').val(),
         organization : $('#organization').val(),
    
     },
      success: function(result) {
        if(result=='success') {
        ServiceTable($('#equip_id').val());   <--CALLS SECOND FUNCTION  
       }                
        }          
    }); 
    

    Return string “success” from ‘qry_creats_record.php’.

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

Sidebar

Related Questions

This problem may seem like school work, but it isn't. At best it is
This problem may be a little broad, but I'm going to go ahead and
This may be a basic problem in the database world but I don't speak
I may be approaching this problem from the wrong angle but what I'm thinking
I am new at JavaScript so I think my problem may be simple. This
Some of you may recognize this as Project Euler's problem number 11. The one
This may sound extremely dim, but where exactly do I place a stored procedure
This may be a server question, but I'm asking how to do this system
this may seem obvious, but I've been researching this all night to no avail.
This may be considered a duplicate but I did trawl through similar questions and

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.