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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:20:59+00:00 2026-06-12T03:20:59+00:00

I am using jquery and I have 2 ajax call function. When I call

  • 0

I am using jquery and I have 2 ajax call function. When I call the first ajax request then
the result will display at div id=”result”. Then I call the second ajax and I want it to display at div id=”result” as well and replace the previous result which return from first ajax. From my tested, I still able to see the previous result under browser developer tools.

The second question is, if repeatly click will cause memory leak or not?

$.ajax({
  url: "ajax/func1",
  type: "post"
});

$.ajax({
  url: "ajax/func2",
  type: "post"
});
  • 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-12T03:21:01+00:00Added an answer on June 12, 2026 at 3:21 am

    Then I call the second ajax and I want it to display at div id="result" as well and replace the previous result which return from first ajax.

    Using the html() method should replace the content with the returned result every time.
    You can assign the result to your div in the done callback for example.

    $.ajax({
      url: "ajax/func1",
      type: "post"
    }).done(function(result) { 
      $("#result").html(result);
    });
    
    $.ajax({
      url: "ajax/func2",
      type: "post"
    }).done(function(result) { 
      $("#result").html(result);
    });
    

    done is essentially the same as success but if I understood the comments in the documentation correctly is might be deprecated soon.

    Deprecation Notice: The jqXHR.success(), jqXHR.error(), and
    jqXHR.complete() callbacks will be deprecated in jQuery 1.8. To
    prepare your code for their eventual removal, use jqXHR.done(),
    jqXHR.fail(), and jqXHR.always() instead.

    if repeatedly click will cause memory leak or not?

    No, it should not cause a memory leak. All requests should execute after each other.

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

Sidebar

Related Questions

I am using jquery UI tabs I have three ajax tabs like so: <div
I am using the jQuery $.ajax() function. I have put this into a parent
I want to do the search using ajax jquery js, for that I have
I am using jQuery and Ruby On Rails. I have an ajax call $.get()
I'm using Ajax via jQuery for the first time ever. I have an html
I have started using ajax/jQuery in our websites / application. There are many plugins
So I have a system using jQuery AJAX to load the content dynamically. I
I'm using jQuery to drive my AJAX UI. I have a table of data,
I have some content that I am loading using jquery ajax. The content has
I'm using jQuery. I have website feature that does an ajax search and returns

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.