0

I created a content type that is used to display a list of videos hosted on brightcove. I have a module that is setting a cookie for the anonymous user when they watch one.

I created a module that will display the video that they clicked in a popup. Inside this popup window there is a button to go to the next video. When they clicked the video that launched the initial popup I can use jquery to change a div class to get a viewed icon to appear next to the video link no problem.

When the "next video" button is clicked I have it play the next video in the same popup. However, I would like to have the "video viewed" icon appear without a refresh on the originating page.

You can see this in action at http://www.lynda.com when you watch one of their videos. You click a video on the course list, a popup appears and you can click the next video button. A viewed icon will appear without refresh on the course list (not the popup).

How do I use ajax in such a way that when a button is clicked it updates a different page? In the pop-up I am passing a video ID as well as the drupal node id of the course the video belongs to.

1

If you are using JavaScript to open your new window, you can assign that window a name and refer to its parent (or refer to it from the parent, as well). One site that explains this is at http://www.codeproject.com/Articles/25388/Accessing-parent-window-from-child-window-or-vice

| improve this answer | |
0

This answer was a little different than what I had in mind but since I was updating the cookie information when the Next video button was clicked to set the ID of the video in the cookie I used a js cookie listener found here: https://stackoverflow.com/questions/5908504/jquery-cookie-monitor Whenever the cookie is updated I can then check it and mark the video as viewed with jquery. If anyone has another solution I would love to hear it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.