I'm using the JQuery getJSON function to get some JSON-formatted data.
The data will be used along with the YouTube JavaScript API: http://code.google.com/apis/youtube/js_api_reference.html
The JSON data is not pulled from YouTube. It's a simple, hand-written list of YouTube Video ID's and Titles which are listed on a CSV. I'm using PHP to read the CSV and create a JSON object.
The root of the problem is that when I put any of the YouTube JavaScript API code within "document.ready", the YouTube code mysteriously ceases to work.
I have gotten the complete player to function (with JSON inclded on the HTML page), but now I am facing this obstacle as I try to externalize the data (use $getJSON). For my player to work, I need to have the JQuery code first and inside document.ready. Next, I need to have the YouTube player code and it should be outside of document.ready.
Here is my failed attempt to get the data returned by $getJSON:
$(document).ready(function(){
$.getJSON('bar.php', function(data) {
var baz = data;
return baz;
}); // getJSON
}) // ready
console.log("baz: " + baz);
How to I get the value of baz?