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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:26:40+00:00 2026-06-18T23:26:40+00:00

I have a function to grab a video title from a YouTube json callback,

  • 0

I have a function to grab a video title from a YouTube json callback, which works – however I’m having issues inserting the variable into an element.

Here is the feed I’m grabbing:

<script type="text/javascript" src="http://gdata.youtube.com/feeds/api/videos/2WNrx2jq184?v=2&amp;alt=json-in-script&amp;callback=youtubeFeedCallback"></script>

The javascript function I’m using:

function youtubeFeedCallback(data) {
var info = data.entry.title.$t;
document.write(info);
}

This works fine, but I’d like to insert it into a div with the ID “box”.

Usually I would use the following (and add it to the function – and remove the document.write):

var box = document.getElementById('box');
box.innerHTML = info;

I just cannot get this to work though. What would be the correct way to achieve what I’m trying to do? Thanks

http://jsfiddle.net/b3VYT/

  • 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-18T23:26:41+00:00Added an answer on June 18, 2026 at 11:26 pm

    Either make sure that the script is below the element or wrap your code in a document.ready callback so that it is not run until after the DOM is loaded.

    http://jsfiddle.net/b3VYT/1

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

Sidebar

Related Questions

I have a video file which I need to grab using a function instead
I am trying to have a function grab an object from a php file
I have a function for creating a tooltip from a title. I am trying
I created a simple test for a function to grab the video id from
Hi I have the function below which grabs and saves screenshots. It works 50%
I have this function and i want to grab the values from the prmpts
I have function LoadTempMovieList(), and need to load movies from sessionStorage. But it seems
I have function some_func_1 which will create an object of type some_type and will
Inside my Controller i have function that runs after user clicks on item, which
I have these codes: Contents of main.php : Javascript function grab() { $(#div_id).load(/test.php); }

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.