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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:36:32+00:00 2026-05-15T10:36:32+00:00

Okay, so I have an javascript function that retrieves some HTML… function updateQuestions(i){ var

  • 0

Okay, so I have an javascript function that retrieves some HTML…

function updateQuestions(i){
    var url = 'getQuestions.php?sys=' + i;
    if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
        receiveReq.open("GET", url, true);
        receiveReq.onreadystatechange = handleQuestionsUpdate; 
        receiveReq.send(null);
    }
}

function handleQuestionsUpdate() {
    if (receiveReq.readyState == 4) {
        var a=receiveReq.responseText;
        document.getElementById('questions').innerHTML=a;
        checkSpeakers(); //Error Occurs Here, even though checkSpeakers() is a function in the returned HTML chunk.
    }   
}

This HTML is not just HTML, but it is more specifically a form and a chunk of javascript. The javascript is hard-coded into the HTML and not referenced by <script src=”..”>

Is it normal that this retrieved JS code isn’t recognized upon call-time? If so, what is my alternative if I need the JS to change every time the div is update?

This is the text being returned to the javascript function.

function checkPillowSpeakers()
{
    var pillowSpeakers = document.getElementById('Q9').value + document.getElementById('Q10').value;
    document.getElementById('PS1').style.display = ((pillowSpeakers > 0)? '' : 'none');
    document.getElementById('PS2').style.display = ((pillowSpeakers > 0)? '' : 'none');
}~ARRAYSEPERATOR~<html>....</html>

The JS Code is seperated from the HTML code by an ~ARRAYSEPERATOR~ tag. The issue is that I don’t want to EXECUTE the code at this time, I just want it queued so I can call it on command.

  • 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-15T10:36:33+00:00Added an answer on May 15, 2026 at 10:36 am

    After doing a whole lot of research, it seems Eval() has some memory issues… so I actually came across this solution:

    //Firstly, create a div called codeHolder
    
    var javascriptCode="function test(){.....}";
    var JSONCode=document.createElement("script");
    JSONCode.setAttribute("type","text/javascript");
    JSONCode.text=javascriptCode;
    
    var cell=document.getElementById("codeHolder");
    if ( cell.hasChildNodes() )
        while ( cell.childNodes.length >= 1 )
            cell.removeChild( cell.firstChild );
    
    cell.appendChild(JSONCode);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 463k
  • Answers 463k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Lambda expressions by themselves have no type and are not… May 16, 2026 at 12:37 am
  • Editorial Team
    Editorial Team added an answer + only has the special meaning of being a space… May 16, 2026 at 12:37 am
  • Editorial Team
    Editorial Team added an answer Completely biased response: learn plyr, reshape2 and ggplot2. They will… May 16, 2026 at 12:37 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.