# Dataset population of embedded websites

**URL:** <https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276>\
**Category:** Ask the community\
**Tags:** question, code\
**Created:** [December 6, 2017, 6:21pm UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276 "2017-12-06T18:21:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![brooke-wentzel-steph](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/brooke-wentzel-steph/32/1152_2.png) [@brooke-wentzel-steph](https://forum.wixstudio.com/u/brooke-wentzel-steph)\
**Post date:** [December 6, 2017, 6:21pm UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/1 "2017-12-06T18:21:38Z")

</div>

I would like the URLs in my dataset to be able to be connected to the “embed a site” option found under the “more” tab of the add option. It doesn’t allow my dataset to connect. My purpose is so that whatever the URL references to will show on each dynamic page.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [December 7, 2017, 1:34pm UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/2 "2017-12-07T13:34:18Z")

</div>

Hi Brooke,

You can use HTML components for that.  
Have a look [here](https://www.wix.com/code/reference/$w.HtmlComponent.html) at the HTML component coding API.  
Seems like you just need to [get the URL out of the dataset current item](https://www.wix.com/code/reference/wix-dataset.html#getCurrentItem) and then set the HTML components ‘src’ attribute.

Hope this helps,

Liran.

---

<div class="post-metadata">

**Author:** ![daniel-thomas](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@daniel-thomas](https://forum.wixstudio.com/u/daniel-thomas)\
**Post date:** [January 3, 2018, 6:54pm UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/3 "2018-01-03T18:54:32Z")

</div>

Hi Liran,

Are you able to please give an example of the code that would be used in the HTML embed widget to access a URL in a dataset? For example, consider a database called ‘My\_Database’ with two fields, the header of first field being ‘Title’ and the header of the second field being ‘URL’. The URL field is populated with the text ‘[www.example.com/embed](http://www.example.com/embed)’. Can you please give an example of how we would write the HTML code for an HTML embed widget on a dynamic page so that we could access the URL field of My\_Database to display [www.example.com/embed](http://www.example.com/embed)?

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [January 5, 2018, 9:27am UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/4 "2018-01-05T09:27:25Z")

</div>

Hi Daniel,  
I assume you want this to happen as soon as the page loads.  
Let’s say I have an entry there:  
liran [www.example.com](http://www.example.com)

And let’s say that you have an HTML component called ‘#html1’.  
Here’s a skeleton, adjust it to your needs:

```javascript
import wixData from 'wix-data';
$w.onReady(function(){
    const titleToFind = 'liran';
    wixData.query('My_Database').eq('title', titleToFind).find()
        .then(result => {
            //check to see if we found the item
            if (result.items.length > 0) {
                const item = result.items[0];
                $w('#html1').src = item.URL;
            }
        });
});

```

Hope this helps,

Liran.

---

<div class="post-metadata">

**Author:** ![daniel-thomas](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@daniel-thomas](https://forum.wixstudio.com/u/daniel-thomas)\
**Post date:** [January 5, 2018, 10:08pm UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/5 "2018-01-05T22:08:57Z")

</div>

Hi Liran,

Excellent, thank you. So, is the next step to place “src=item.URL” in the HTML component code? Are you able to please give a skeleton code example for the HTML component?

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/system/32/86885_2.png) [@system](https://forum.wixstudio.com/u/system)\
**Post date:** [January 8, 2018, 8:42am UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/6 "2018-01-08T08:42:12Z")

</div>

Hi Daniel,  
I’m not sure I understand the question… but if you mean changing the code itself inside the HTML component, you don’t need to do that.  
HTML component can have either HTML code or just a URL to load.  
So the skeleton I provided is changing the URL itself (no need for HTML code) - it should be enough.

Liran.

---

<div class="post-metadata">

**Author:** ![daniel-thomas](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@daniel-thomas](https://forum.wixstudio.com/u/daniel-thomas)\
**Post date:** [January 8, 2018, 9:02am UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/7 "2018-01-08T09:02:08Z")

</div>

Oh, OK. Great, thanks. I will try again.

---

<div class="post-metadata">

**Author:** ![daniel-thomas](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@daniel-thomas](https://forum.wixstudio.com/u/daniel-thomas)\
**Post date:** [January 30, 2018, 7:52pm UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/8 "2018-01-30T19:52:28Z")

</div>

HI Liran,

Still no luck. Are you able to please take a look at the page I am working on? I can send details via email and return here to post the solution.

---

<div class="post-metadata">

**Author:** ![daniel-thomas](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@daniel-thomas](https://forum.wixstudio.com/u/daniel-thomas)\
**Post date:** [February 1, 2018, 7:00pm UTC](https://forum.wixstudio.com/t/dataset-population-of-embedded-websites/12276/9 "2018-02-01T19:00:45Z")

</div>

Hi Liran,

Thanks for your help - I figured it out. If anyone is interested they can head over to this thread:

> **[Dynamic page with html embedded with url from database | Velo by Wix](https://community.wix.com/velo/forum/coding-with-velo/dynamic-page-with-html-embedded-with-url-from-database)**
>
> Hi,
> 
> I am trying to embed an html component onto a dynamic page. 
> The html code is the same throughout all the dynamic pages except for the ''src'' which is a url that I want to get from the database.
> 
> Is it possible to do that?
