I have an html table based on a JSON source at the bottom of https://verlager.pro/music.php?jb=rock
{“YT_id”:“Qfid-_BFUZM”, “title”:“Bad Time”, “author”:“Grand Funk Railroad”},
{“YT_id”:“mW7saHHX6jA”, “title”:“Forever Man”, “author”:“Beat Street”},
{“YT_id”:“2oT0UAoe0eQ”, “title”:“Slave to Love”, “author”:“Roxy Music”},
{“YT_id”:“2RamSFoo0jw”, “title”:“Magnet and Steel”, “author”:“Walter Egan”}
I want to click on a tr and load a hystModal modal with a link to a youtube video.
// CLICK ON TR, EXTRACT THE THREE TD’S IN THAT ROW (NOT A PROBLEM)
function load_url () {
var test = document.getElementById(‘container’);
var rows = container.getElementsByTagName(‘tr’);
for (var i = 1; i < rows.length; i++) {
rows[i].addEventListener(‘click’, function() {
// Do something when a row is clicked
S0 = this.cells[0].textContent;
S1 = this.cells[1].textContent;
S2 = this.cells[2].textContent;
}
);
}}
MODAL INVOKE - WORKS BUT I NEED TO PASS S0 (YT_id), S1 (title), S2 (author) TO THE MODAL WITH THE TR onclick. PERHAPS function music_on (S0, S1, S2);
THIS WORKS BUT DOES ME NO GOOD
Open modal with id=myModal
MODAL CONTENT
HOW DO I PASS JS VAR “S0” TO IFRAME?