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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:46:09+00:00 2026-05-17T22:46:09+00:00

I have the following Ajax call which send form data to a page and

  • 0

I have the following Ajax call which send form data to a page and finds specific response.

$.ajax({
    url: $("form[name='MainForm']").attr('action'),
    data: $("form[name='MainForm']").serialize()+'&btnupdateprice.x=0&btnupdateprice.y=0',
    type: 'POST', 
    cache: false,
    success: function(response) {
        errors = $(response).find("#listOfErrorsSpan");
        result2= $(response).find(".colors_pricebox:eq(0)");
        $(".colors_pricebox:eq(0)").replaceWith(
            '<table width="100%" cellspacing="0"  cellpadding="0" border="0" class="colors_pricebox">' + result2.html() + '</table>');
        $('#listOfErrorsSpan').replaceWith(
            '<span id="listOfErrorsSpan">' + errors.html() + '</span>');
    }
});

Each time the page call this page via Ajax it loads about 74k of data. I do not have a specific programming question but instead would like to know if there is a way or ways to limit the possibility of any leaks or…. in this case, I extract out two areas of the loaded page and store it in variable “error” and variable “result2”.

Do I need to do something like destroy, detach or otherwise “remove” the unused data in the response. Is it stored somewhere. Each reload via Ajax does it get overwritten or take up new space. Do or should I need to destroy the error and result 2 variables once they are used since they are no longer needed? Or perhaps I would or should not use the variables to store the result and just do this directly as shown below?

Sorry if I am not making much sense. Not very familiar with this. I would just like to know if there is anything I should be concerned with with regards to leaks. Thanks for any feedback.

$(".colors_pricebox:eq(0)").replaceWith(
    '<table width="100%" cellspacing="0" cellpadding="0" border="0" class="colors_pricebox">' + $(response).find(".colors_pricebox:eq(0)") + '</table>');

$('#listOfErrorsSpan').replaceWith(
    '<span id="listOfErrorsSpan">' + $(response).find("#listOfErrorsSpan").html() + '</span>');
  • 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-05-17T22:46:10+00:00Added an answer on May 17, 2026 at 10:46 pm

    Exactly what is the symptom(s) and on which browser(s)?

    JavaScript is a GC-language and objects which are not reachable are removed (reclaimed) as appropriate (this is slightly “catching” as execution contexts are bound upon but…). Unless there is a specific problem, don’t worry about it 🙂 — I can think of some contrived examples involving execution context with temporary data held onto for far too long, but in practice I have not run into such a case that actually did matter. Jibbering Notes: JavaScript Closures talks about execution contexts and scopes which should cover this potential form of “leak”.

    If you do run into such a case, you can release references (e.g. x = null) or use the delete keyword. These do not actually “delete” the object (the delete keyword can remove properties), but can (if there are no longer any references) make it eligible for reclamation.

    In the code above, it looks like “global” variables (error and result2) are being used, if so (and they are not needed), using local variables may make more objects eligible for reclamation as the local variables will perish with the execution context (thus potentially making the objects they contain eligible for reclamation). However, the next time the callback runs the values will be overwritten which (unless there is another reference held) will make the previous objects eligible for reclamation — that is, there is no compounding problems. Compare that with:

    globalArrayThatIsNeverCleared.push(result2)
    

    There are (or were?) also some IE memory leaks caused by access to objects “outside” the JavaScript GC which resulted in cyclic graphs that could not be freed, etc.

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

Sidebar

Related Questions

Have the following in an fancybox ajax call $.ajax({ type: 'POST', url: 'sendmesse.php', data:
I have the following code to make a jsonp call. var contacts; $.ajax({ url:
I have the following code: $.ajax({ async: false, url: 'chart_data.php', data: {'option':'high', 'id':id}, dataType:
I have the following ajax call which works perfectly in Firefox and Chrome but
I have a jQuery ajax call in which I am trying to send the
I have the following ajax call which checks to see if the user is
I have the following $.ajax({ type: POST, url: qry_invControl.cfm, data: p_sales_price= + input.val() +
Within a Flask app, I have the following ajax call: $.ajax({ url: {{ url_for(
I have the following code: $.ajax({ type: POST, url: url, data: sendable, dataType: json,
I have a simple ajax call: $.ajax({url: my_url_here, dataType: 'text', success: function(data, textStatus) {

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.