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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:26:21+00:00 2026-05-28T06:26:21+00:00

Just a simple question. (probably really basic I quess) Using XmlHttp I am able

  • 0

Just a simple question. (probably really basic I quess)

Using XmlHttp I am able to load a page, but not sure how to iclude the js files..

How can I alter the code in the images below, to be able to include the two java script files into the page loaded with ajax? I’m by far not a java script programmer, so really needs some help.

Thank you.

clientside.php:

<html>
<head>
<title></title>
  <script src="XmlHttp.js"></script>
  <script>
    var urlServer ="serverside.php";
    var xmlObj = null;

    function callServer(urlServer){
      xmlObj= XmlHttp.create();
          if(xmlObj) {
            xmlObj.onreadystatechange = responseFromServer;
            xmlObj.open("GET", urlServer, true);
            xmlObj.send();
          }
    }       

    function responseFromServer() {
      if (xmlObj.readyState == 4) {
        if (xmlObj.status == 200) {
          document.getElementById("main").innerHTML = xmlObj.responseXML.getElementsByTagName("mybody")[0].firstChild.nodeValue;
          eval(xmlObj.responseXML.getElementsByTagName("myscript")[0].firstChild.nodeValue);                
        }
      }
    }   
  </script>
</head>
<body>
  <div id="main"></div>
  <input type="button" value="Begin test" onClick="callServer(urlServer)">
</body>
</html>



serverside.php :

<?php
  //How do I load these two javascript files together with the <body> below.
  //Obviously the method below does not work..
  $script="
   <script type='text/javascript' src='SlimBox/js/mootools.js'></script>
   <script type='text/javascript' src='SlimBox/js/slimbox.js'></script>
  ";

  $body="
    <body>
    <a href='img/facebook-icon.png' rel='lightbox[roadtrip]' cap='test'><img alt=''border='0' src='img/facebook-icon.png' /></a>
    </body>
  ";

  //Now build the xml page:
  $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
  $xml .= "<mypage>";
  $xml .= "<myscript>".htmlentities($script)."</myscript>";
  $xml .= "<mybody>".htmlentities($body)."</mybody>";
  $xml .= "</mypage>";
  header('Content-type: text/xml');
  echo $xml;
?>
  • 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-28T06:26:22+00:00Added an answer on May 28, 2026 at 6:26 am

    most efficient way will be to use ajax to load script source(uri) and use javavcript to update script source

    Something like:

     document.getElementById('external_script').src = 'http://cross.domain.com/other.js';
    

    Fore more on how to load script dynamically check

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

Sidebar

Related Questions

Um, probably a really simple question, but I just noticed that I have no
This is probably a really simple question, and I'm just not getting it. I'd
I've come to bother you all with another probably really simple C question. Using
Probably simple question and I'm just missing something, but I'm stuck out of ideas.
I just started working with assembly so this is probably a really simple question,
There is probably a simple answer to this question but I do not have
I think its quite a simple question but not sure. I have a class:
Sorry for really simple question, but I wasnt able to find anything in the
I know this is probably a really simple question but I'm having a brain
I just gave an answer to a quite simple question by using an extension

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.