Changing iframe url values with variable from text file

Changing iframe url values with variable from text file

I am trying to read urls from a text file into a common video iFrame command using jquery and wordpress. Here is the example for the code as an example of what I am trying to do. I just want the video on refresh to change as does the line below which is what needs to change to play different videos with different stop and start points. 


The video at the top of the above page is a static example iframe command I am trying to use. The randomized variable is displaying below the video (<div class="video">) and I am trying to substitute the url variables from the video.txt file for the main video at the top each time the page is refreshed. 

Refreshing the page does change the variable displaying below the video correctly, but I can't seem to combine the two notions and have the video url, with start and stop parameters, play the video with respect to the variable of the file. I have tried many iterations and will spare you my main failed attempts at the proper replacement of the iframe command but am pretty sure I am just missing something simple as I am not a good coder, just trying to learn. 

Any help is sincerely appreciated. 

The code from the example above is:

<iframe width="854" height="480" src=" https://www.youtube.com/embed/ad5pmvJ0zMQ?start=1&end=23" frameborder="0" allowfullscreen></iframe>

<div class="video">

<script type="text/javascript" src="js/jquery.js"></script>
<script>// <
jQuery(document).ready(function($) {
    $.get('/wp-content/slap/video.txt', function(data) {
        var video = data.split("@");
        var idx = Math.floor(video.length * Math.random());
        $('.video').html(video[idx]);
    });
});
</script>

-------

The video.txt file looks like this: