# Data from the dynamic page in the lightbox

**URL:** <https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [November 8, 2019, 3:38pm UTC](https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493 "2019-11-08T15:38:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakub](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jakub/32/1674_2.png) [@jakub](https://forum.wixstudio.com/u/jakub)\
**Post date:** [November 8, 2019, 3:38pm UTC](https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493/1 "2019-11-08T15:38:03Z")

</div>

Hey guys,

I’m currently facing some issues when I’m trying to play video in the lightbox.  
There is user content on a dynamic page like text, images, and video.  
There is also a button which opens the lightbox, where I would like to play that video.  
I have a code, but it does not work as I would wish, because it will load only the last uploaded video from the database, not the one I want to.

The dynamic page code:

```javascript
import wixWindow from 'wix-window';

export function playvideo_onClick(event, $w) {
  wixWindow.openLightbox("Recenze", currentItem);
}

```

The lightbox code:

```javascript
import wixWindow from 'wix-window';
$w.onReady(function () {
  const data = wixWindow.lightbox.getContext();
  $w('#video1').videoUrl = data.video;    
});

```

Does anyone of you have an idea, how to proceed?

Thanks,  
J.

---

<div class="post-metadata">

**Author:** ![jakub](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jakub/32/1674_2.png) [@jakub](https://forum.wixstudio.com/u/jakub)\
**Post date:** [November 8, 2019, 7:22pm UTC](https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493/2 "2019-11-08T19:22:57Z")

</div>

Issue solved.  
For more info do not hesitate to visit:  
[https://www.wix.com/corvid/forum/community-discussion/dynamic-lightboxes-1](https://www.wix.com/corvid/forum/community-discussion/dynamic-lightboxes-1)  
[https://www.wix.com/corvid/reference/wix-window.html#openLightbox](https://www.wix.com/corvid/reference/wix-window.html#openLightbox)

The dynamic page code:

```javascript
import wixData from "wix-data";
import wixWindow from 'wix-window';
var currentItem, ds; 

export function playvideo_onClick(event) {
  wixWindow.openLightbox("Recenze", {
 "pageSend1": $w('#videoPlayer1').src,
 "pageSend2": $w('#ID').text
  })
  .then( (data) => {
    $w('#videoPlayer1').src = data.lightboxSend1;
    $w('#ID').text = data.lightboxSend2;
  } );
}

```

The lightbox code:

```javascript
import wixWindow from 'wix-window';

$w.onReady( function () {
 let received = wixWindow.lightbox.getContext();
  $w('#video1').videoUrl = received.pageSend1;
  $w('#ID').text = received.pageSend2;
} );

export function closeButton_click(event) {
  wixWindow.lightbox.close( {
 "lightBoxSend1": $w('#video1').videoUrl,
 "lightBoxSend2": $w('#ID').text
  } );
}

```

Br,  
Jakub

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [November 8, 2019, 8:03pm UTC](https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493/3 "2019-11-08T20:03:23Z")

</div>

Well done for finding your needed answer through the forum yourself.

Although, what happened to your previous post about this from Feb 2018?

![](https://us1.discourse-cdn.com/wix/original/3X/e/b/eb3b5237e82acfe02e4daf55c39aaafead0d2224.png)

 ![](https://us1.discourse-cdn.com/wix/original/3X/0/4/043a0bfa6b3b9d6399b79c3b9e18200a3b8db59e.png)

---

<div class="post-metadata">

**Author:** ![jakub](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/jakub/32/1674_2.png) [@jakub](https://forum.wixstudio.com/u/jakub)\
**Post date:** [November 8, 2019, 8:13pm UTC](https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493/4 "2019-11-08T20:13:40Z")

</div>

Thanks. I deleted the previous post. This one is more clear to understand.

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [November 8, 2019, 9:04pm UTC](https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493/5 "2019-11-08T21:04:33Z")

</div>

@jakub  
No worries and thanks for the reply, clears it up perfectly.

---

<div class="post-metadata">

**Author:** ![mann-woods](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@mann-woods](https://forum.wixstudio.com/u/mann-woods)\
**Post date:** [September 5, 2021, 7:44pm UTC](https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493/6 "2021-09-05T19:44:22Z")

</div>

@jakub Help!!! I need to do this same thing!! But i can’t seem to do it right! Have a button (button7) to open a video lightbox to play video from a URL in the dataset for the specific item/page. I’m stuck!!!

---

<div class="post-metadata">

**Author:** ![support10571](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/support10571/32/30688_2.png) [@support10571](https://forum.wixstudio.com/u/support10571)\
**Post date:** [August 29, 2022, 8:17pm UTC](https://forum.wixstudio.com/t/data-from-the-dynamic-page-in-the-lightbox/37493/7 "2022-08-29T20:17:05Z")

</div>

Having a similar issue, but I can’t even get my Lightbox to open using your code… thoughts?
