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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:44:15+00:00 2026-05-19T12:44:15+00:00

i am having a bit of a problem here and i don’t even know

  • 0

i am having a bit of a problem here and i don’t even know if it is possible at all, here’s my dilema:

I have this script code:

<script id='script1' src='http://link.to.js'></script>

While using firebug, i can clearly see that the script has bee loaded between those tags, like this

<script id='script1' src='http://link.to.js'>
  function something(){
    alert('hi');}
</script>

What i want to do is, by means of another script, get the content between those tags, something like

var x = document.getElementById('script1').innerHtml;
document.getElementById('somedividhere').innerHtml = x;

That works perfectly WHEN the code is already part of the html, not when its loaded from src.

I have been looking for this for hours and i have not found any hint, hope someone can help me on this.

  • 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-19T12:44:16+00:00Added an answer on May 19, 2026 at 12:44 pm

    I think Firebug only shows you that for convenience sake. If you want to get the code from the script, you’ll have to use AJAX.

    You could do something like this:

    function ajaxFunction(){
        var ajaxRequest;  // The variable that makes Ajax possible!
    
        try{
            // Opera 8.0+, Firefox, Safari
            ajaxRequest = new XMLHttpRequest();
        } catch (e){
            // Internet Explorer Browsers
            try{
                ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try{
                    ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e){
                    // Something went wrong
                    alert("Your browser broke!");
                    return false;
                }
            }
        }
        // Create a function that will receive data sent from the server
        ajaxRequest.onreadystatechange = function(){
            if(ajaxRequest.readyState == 4){
                var scriptcontent = ajaxRequest.responseText;
                //Do something with the content
            }
        }
        ajaxRequest.open("GET", document.getElementById('script1').src, true);
        ajaxRequest.send(null);
    }
    

    Just a few notes:

    1. This will only work for scripts
      located on your site due to the
      same origin
      policy
      .
    2. I took the ajax code from this
      site

      and modified it.
    3. This would be a lot
      easier with
      jQuery
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a bit of a problem, don't even know if this is doable.
I'm having a bit of a problem here. We have 2 urls let me
I'm a complete beginner with jQuery and I have this bit of script here
I am having a bit of a problem here with this statement below using
Having a bit of a problem here on a matrix multiplication code. I seem
I'm having a little bit of trouble understanding what the problem is here. I
I'm having a bit of a problem. I have a datatable in the parent
I'm having a bit of a problem using FieldOffset correctly with arrays. The code
I'm having a problem executing a certain bit of AJAX. Here is how I
I am having a bit of a problem with my UI hanging even though

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.