loading video from url array key

November 26, 2016, at 9:05 PM

i need help editing my JS code

when i click on one of button video 1 or video 2 , it will get data-str from button to end of url with php

but when i navigate to that url that is with data-str at end of it, it will load default video not from data-str that is on url. i don't know how to explain hope you guys understand.

here's my full code on plnkr http://plnkr.co/edit/LhxRjJXBnCGKGfW4ZLWO?p=preview

here is my JS code

    $(document).ready(function() {
      //action listener for video_link class
      $('.video_link').click(function(e) {
        $('.frame_src').attr('src', 'https://www.youtube.com/embed/' + $(this).data('str'));
        window.history.pushState({},"",window.location.origin + window.location.pathname + '?video=' + $(this).data('str'));
        $(".frame_src").attr("data-src", "https://www.youtube.com/embed/p9zdCra9gCE");
        var t = "p9zdCra9gCE",
            e = $(".embed_code").attr("data-content");
        e = e.replace("[videoID]", t), $(".embed_code").html(e), $(".video_button").slideDown(), $(".video_link").click(function() {
            var t = $(this).attr("data-str"),
                e = "https://www.youtube.com/embed/" + t + "",
                a = $(".embed_code").attr("data-content");
            a = a.replace("[videoID]", t), $(".embed_code").html(a), $(".frame_src").attr("src", e), clearInterval(interval), document.querySelector(".load_video").style.display = "none", $(".frame_src").show()
What is this jQuery function in pseudo code?

What is this jQuery function in pseudo code?

I am new to programming and trying to get a better understanding of how jQuery functions workCould someone explain this code snippet to me in pseudocode? Also, is the formatting of 2 spaces correct or is it more common to use 4?

jQuery file Upload and ajax

jQuery file Upload and ajax

So, I have the following form and js/php:

Jquery resize document height

Jquery resize document height

I'm having a little trouble with my jQuery/JS code

Code form jsfiddle doesn&#39;t work

Code form jsfiddle doesn't work

I need a piece of code to use in my website (that I hardly found), but when I use it inside my html file, it doesn't work