Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- const fetchVideoIds = (cb) => {
- const http = new XMLHttpRequest();
- const url = 'http://localhost/fetchIds.php';
- http.open("GET", url, true);
- http.onreadystatechange = function()
- {
- if(http.readyState == 4 && http.status == 200) {
- cb(http.responseText);
- }
- }
- http.send(null);
- };
- const openVideoWindow = (videoIds) => {
- const youtube = 'https://www.youtube.com/watch?v=';
- const videos = JSON.parse(videoIds) || {};
- for (let i in videos) {
- window.open(youtube + videos[i]);
- }
- }
- fetchVideoIds(openVideoWindow);
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement