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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:44:36+00:00 2026-06-10T12:44:36+00:00

Possible Duplicate: How do you execute a dynamically loaded JavaScript block? I have seen

  • 0

Possible Duplicate:
How do you execute a dynamically loaded JavaScript block?

I have seen many questions like mine here, but I didn’t find an answer which is fitting for me.

I’m loading Code via AJAX, also including a script Tag including Javascript. As I already found out, this Javascript is not executed.

I also found out that eval() can help me, but as I’m a noob in Javascript and just need it for this one time, I have no idea where exactly to put it.

My PHP script is returning a string which I split with Javascript to put it into different parts of the page. This is working fine. One of the parts consists of this:

<div id=\"fb-root\"></div> <script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];if (d.getElementById(id)) return;js = d.createElement(s); js.id = id;js.src = \"//connect.facebook.net/de_DE/all.js#xfbml=1\";fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>

Included like this:

document.getElementById("id").innerHTML=response1;

Where response1 is the variable where I have put the code from above after splitting the string. Anyone able to help me in a noob, easy 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-06-10T12:44:38+00:00Added an answer on June 10, 2026 at 12:44 pm

    You can use eval(). You have to give an ID to your script:

    <script id='script'>
         some javascript
    </script>
    

    And then after loading your ajax response, for loading the script you add this line:

    eval(document.getElementById('script').innerHTML);
    

    Good luck!

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

Sidebar

Related Questions

Possible Duplicate: How to execute a JavaScript function when I have its name as
Possible Duplicate: $(document).ready equivalent without jQuery I have a framework-less javascript that executes on
Possible Duplicate: Execute another jar in a java program I have an executable jar
Possible Duplicate: How can I execute a block of code exactly once in PHP?
Possible Duplicate: Request UAC elevation from within a Python script? I'd like to execute
Possible Duplicate: JavaScript alert not working in Firefox 6 I often execute Javascript code
Possible Duplicate: Do you ever need to specify javascript: in an onclick? To execute
Possible Duplicate: Choose order to execute JUnit tests I am writing a JUnit test.
Possible Duplicate: .htaccess rewrite image file to php script How can I execute a
Possible Duplicate: && operator in Javascript In the sample code of the ExtJS web

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.