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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:57:30+00:00 2026-05-26T11:57:30+00:00

I have a page which uses the long-polling technique to get data back from

  • 0

I have a page which uses the long-polling technique to get data back from the server in parts, creating script tags containing IIFE expressions, that will look something like this:

<script>
  (function(){ 
      $("#blah").append("Some new data");
  })();
</script>

If I get a LOT of these excess <script> tags, especially if the New Data is relatively large, I’m worried that it’s going to start slowing down the page.
Would there be any performance benefit removing the script tag from the DOM after it has executed?

<script id="thescript">
  (function(){ 
      $("#blah").append("Some new data");
  })();
  $("#thescript").remove();
</script>

EDIT: I feel like this question has become a trainwreck and the intention was unclear. Apologies. Really ultimately looking for the answer to a different question and this is one misguided step along the way.

  • 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-26T11:57:30+00:00Added an answer on May 26, 2026 at 11:57 am

    You could instead just return JavaScript and use jQuery’s $.getScript() method.

    Edit:

    Maybe this would be a more direct answer.

    If you request the script as plain text, you can then append it to the head and remove it.

    $.get(url,function(str){
      var head = $("head"),
          script = $(str);
      head.append(str);
      str.remove();
    },"text");
    

    I haven’t actually tried this, so I’m not 100% sure that it would work. It does sound logical though.

    Another option would be to load the script into a particular element, then empty the element. It should have the same effect.

    Edit Again: you could stick the script tags inside of a particular element with a class, then remove that element on success of the ajax call since you are returning more than just a script tag.

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

Sidebar

Related Questions

I have an application which uses an open JQuery Ajax connection to do long-polling/comet
i have a master page which uses script manager and on another page i
I have a signup form on my home page which uses server side validation
I have an ASP.Net web page, which uses a Master Page template. The page
I have a system that uses a meta refresh to a logout page, which
I have page which is redirected from htaccess. now I can pass the German
I have a page which is largely created by DOM script, which generates a
I have a page which uses cufon and asp:UpdatePanel. After ajax callback the new
Using 960.gs, I have a page which is a login screen which uses a
Creating a popup window from main page with window.open, the child/popup page uses the

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.