Answer the question
In order to leave comments, you need to log in
How to run JavaScript code received via AJAX?
Good afternoon!
There is a player for the site jw player 7. Its connection is as follows:
<script src="js/jwplayer7/jwplayer.js"></script>
<script>jwplayer.key="keykeykeykeykeykeykeykey";</script>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer("myElement");
playerInstance.setup({
file: "http://www.youtube.com/watch?v=XXXXXX",
width: 640,
height: 360,
title: 'title',
});
</script>
<script src="js/jwplayer7/jwplayer.js"></script>
<script>jwplayer.key="keykeykeykeykeykeykeykey";</script>
<div id="videos"></div>
<div id="myElement1">Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer("myElement1");
playerInstance.setup({
file: "http://www.youtube.com/watch?v=XXXXXX",
width: 640,
height: 360,
title: 'title',
});
</script>
<div id="myElement2">Loading the player...</div>
<script type="text/javascript">
var playerInstance = jwplayer("myElement2");
playerInstance.setup({
file: "http://www.youtube.com/watch?v=XXXXXX",
width: 640,
height: 360,
title: 'title',
});
</script>
Answer the question
In order to leave comments, you need to log in
Something I did not understand ... You get what from the database? YouTube URLs? So give them to the frontend with Ajax, where you already generate all these players in the code as you like.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question