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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:24:14+00:00 2026-06-12T05:24:14+00:00

Sorry for the confusing title, but I couldn’t find a better way to explain

  • 0

Sorry for the confusing title, but I couldn’t find a better way to explain it..

Here’s the situation:

In a function overview(), I grab data with an AJAX call, together with dynamic html.
Inside that AJAX success callback, I perform certain handlers to the new html.
On one of those handlers, I’m posting another AJAX call.

Now, here’s my problem: I want to reload the first AJAX call in the second AJAX success callback, to grab my updated data. How do I do this?

Thanks

EDIT: As requested, here’s my code (simplified)

function overview() {
    var dataString = '...';
    $.ajax({
        type: 'POST',
        url: 'get-data.php?',
        cache: false,
        data: dataString,
        success: function(data) {
            $('table.table-overview tr.table-heading').after(data);

            $('tr.new-tr span.status').click(function() {
                var dataString = '...';
                $.ajax({
                    type: 'GET',
                    url: 'change-status.php?',
                    cache: false,
                    data: dataString,
                    success: function(response) {
                        if(response == 'saved') {
                            overview();
                        }
                    }
                });
            });
        }
    });
}

SOLVED: After some trial and error, replacing my .click() handler to .live(‘click’) made it work!

  • 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-12T05:24:15+00:00Added an answer on June 12, 2026 at 5:24 am

    To answer the added sub question, when you run this line of code

    $('tr.new-tr span.status').click(function() {})
    

    you are telling the browser to take every <span class="status"/> inside a <tr class="new-tr"/> that exists at that moment to attach a click event listener. .[live][1]('click') is different (), there you are saying for every click if it is on a inside a then call the function (this works for spans that didn’t exist when the live event was bound). Both approaches are bad inside the success event of the ajax callback. You can bind the live even listener outside of your ajax calls first and then trust that it will only fire on <span class="status"/> inside a <tr class="new-tr"/> even if they are created later.

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

Sidebar

Related Questions

Sorry for the confusing title, but it basically says it all. Here's the structures
Sorry for the confusing title, I couldnt explain it better. Feel free to edit
I'm sorry if the title is confusing but I couldn't think of anything similar
Sorry if the title sounds confusing - but this is what I am trying
I'm sorry if the title is quite confusing but I am wondering if it's
sorry for the confusing title, its really hard for me to explain what i
Sorry if the question title is confusing. Let me explain further. I am building
Sorry for the confusing title :P I'm sure I should know this but I
Sorry for the confusing title, I didn't know how I could describe it better.
Sorry for the confusing title, but I'm not sure what to call those. I'm

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.