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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:52:15+00:00 2026-06-03T22:52:15+00:00

On page load I am calling the function LinkPages() and am going to be

  • 0

On page load I am calling the function LinkPages() and am going to be adding its HTML to a a DIV.

MasterPage.aspx

    function LinkPages()
    var xmlhttp;
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp = new XMLHttpRequest();
    }
    else {// code for IE6, IE5
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    alert(xmlhttp.responseText);
    }
    }
    xmlhttp.open("GET", "Page1.aspx", true);
    xmlhttp.send();
    }

The problem that I ran into is Page1.aspx also has a XMLHttpRequest in function GetMessage that is never being called. GetMessage() is
suppose to set the innerHTML of a span on Page1.aspx and it is not being called.

Page1.aspx

    function GetMessage()
    var xmlhttp;
    if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp = new XMLHttpRequest();
    }
    else {// code for IE6, IE5
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        document.getElementById("lblMessage").innerHTML = xmlhttp.responseText;
    }
    }
    xmlhttp.open("GET", "wfrmHelper.aspx?action=message", true); --returns string
    xmlhttp.send();
    }

Is it possible to call javascript on the page in the XMLHttpRequest?

  • 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-03T22:52:17+00:00Added an answer on June 3, 2026 at 10:52 pm

    In your first XHR on MasterPage.apsx you are calling the server and getting some HTML back (and I am guessing that this Javascript GetMessage is mixed in on that page somewhere). Unless you append your XHR’s responseText to the document, the JavaScript will never get evaluated. So… in LinkPages() you need to add the response from your XKR call to the document, and then the GetMessage function will be evaluated by the browser. Until it gets added, it is only a String in memory. It doesn’t actually turn into script until you place it on the DOM. I hope this makes sense.

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

Sidebar

Related Questions

I calling multiple function on page load in my asp.net web application. All function
In my page load, am I calling ReturnStuff() once or three times? If I
I have an AJAX call to load a function once the page is loaded,
I am calling the following jQuery code on page load to test the concept
Follow on from: Javascript wait for image to load before calling Ajax function initResources()
I'm calling a page via WebForm_DoCallback javascript function. On server, in Page_Load I'm trying
On page load, I'm making two AJAX requests: one to pull the newest video
Is Page.Load the earliest point in the Page.Load life cycle to add Response.AppendHeader?
my customer gets a page load error when he loads our web application after
I want on page load for the class of a li tag to be

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.