I am trying to finish my video view count functionality. I am sending an AJAX post request to create a video view after the video has finished playing. I have a video playlist container that loads new videos via jquery. When I load the page, my AJAX POST call works for the first video in the playlist however, when I click on another video the AJAX request is not recognized.
This is the code I am calling to create the view. The "$('#video1').data('videoId'" loads the video's ID.
jwplayer().onComplete(function(event) {
$.ajax({
type: 'POST',
url: '<%= create_media_view_path %>',
cache: false,
data: { m: $('#video1').data('videoId') }
});
Is there anything special I need to do to make multiple post requests? Do I need to reload this function each time a new video is selected?
Thanks in advance.
I ended up finding the fix... All I needed to do was load the onComplete function again for every video. I simply copied and pasted it into my jquery video container to be reloaded everytime a video is clicked.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.