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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:50:46+00:00 2026-06-02T02:50:46+00:00

The goal is to load script-Tags per ajax, execute the scripts and show the

  • 0

The goal is to load script-Tags per ajax, execute the scripts and show the content of the script-tag (a iframe with a video).

The scenario:
The scenario is a video page. If i click on “video-text” the id in the dom will be determined. After that an ajax-php-request will be executed with the determined id. This request will responese with a script tag. And this is the problem: How can i get the iframe?
Have anyone a tip for me?

ajax-call:

$.ajax({
    type: "GET",
    url: "/get-embed-by-id/"+$(this).find('.views-field-nid .field-content').html(),
    success: postToPageTwo,
    error : postToPageTwo,
    datataype: "html",
});

This call returns a script like this one

<script type="text/javascript" src="http://exampleurl.de/video/7"></script>

The content of this script is for example:

(function(){ 
    document.write('<iframe id="video_11" class="mediacube_video" 
     src="http://exampleurl.de/video/11.html?" scrolling="no" 
     align="center" frameborder="0" framespacing="0" width="725" height="409">
     </iframe>');
})()

EDIT
the code to use with $.getScript:

$.getScript("http://exampleurl.de/video/5", scriptResponse);

and the code of scriptResponse:

function scriptResponse(data) {
  console.log("data:");
  console.log(data);
}

but the data is always undefined. or did i anything wrong?

  • 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-02T02:50:47+00:00Added an answer on June 2, 2026 at 2:50 am

    jQuery has .getScript() to load and execute scripts for you. no need to call an ajax to return an html to load another script (that’s a lot of round trips) just to call a script.

    $.getScript('http://exampleurl.de/video/7');
    

    if the initial request really matters (maybe some parsing on the back-end to determine the link of the script), you can have the initial response return just the url of the script. then use that returned string for the .getScript()

    $.get('initial_url',function(returned_url){
        $.getScript(returned_url);
    });
    

    but still, too many round trips.

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

Sidebar

Related Questions

The goal of my script is that when user scrolls down, my page should
My ultimate goal is to load controls as plugins, for use as DocumentContent in
My goal is to pull XML data from the API and load it to
can I load a ps1 file from within a ps1 file. The end goal
I'm trying to traverse an AJAX response, which contains a remote web page (an
I have just recently implemented the inAppSettings kit. My goal was to load my
Im trying to run a script for a project, the goal is simple :
Goal : When click a link on my navigation will show spinning image until
My original goal was to get a php file to execute on a button
my goal is to load three distinct div elements from an external HTML and

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.