# HTML and Qwik API - How to Get Required JS to Load?

**URL:** <https://forum.builder.io/t/html-and-qwik-api-how-to-get-required-js-to-load/3078>\
**Category:** Technical Questions\
**Created:** [January 12, 2023, 1:28am UTC](https://forum.builder.io/t/html-and-qwik-api-how-to-get-required-js-to-load/3078 "2023-01-12T01:28:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![timlwhite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/timlwhite/32/2277_2.png) [@timlwhite](https://forum.builder.io/u/timlwhite)\
**Post date:** [January 12, 2023, 1:28am UTC](https://forum.builder.io/t/html-and-qwik-api-how-to-get-required-js-to-load/3078/1 "2023-01-12T01:28:34Z")

</div>

When loading via webcomponents/HTML API, the builder area is not pulling in the .js that it needs to activate the components interactive features, including in this case calling the API to get the data. Also happens with sliders, etc. I’ve seen this reported in other threads with no solution other than moving to a different tech stack, which doesn’t seem to make sense.

**Builder content link**

> **[Builder.io: Drag and drop Visual CMS](https://builder.io/content/20c240e081684553a8cdaf2b4ef992db/edit?activeDesignerTab=0)**
>
> Build and optimize digital experiences for any tech stack, visually.

**Builder public api key**  
_8db31f7e69d24ba2afde0c21f78e9022_

**What are you trying to accomplish**  
_e.g. I want to integrate builder on a landing page_

**Screenshots or video link**  
Live:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/0/0904914855487545952be4fa59a18491dbc82af1.jpeg)  
Fallback Editor:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/9/9e6ef21b0af0889d7bc8d12a4521bb83290f7fe4.jpeg)

**Code stack you are integrating Builder with**  
HTML - not an SPA. No React, etc. Just want to pull this into the HTML with the HTML or Qwik API. Ideally will be able to call this server-side.

Here is the client-side code I’m testing with:

```auto
<script async src="https://cdn.builder.io/js/qwik/qwikloader.js"></script>
<div id="my-content"></div>
<script>
  (async () => {
    const qwikUrl = new URL('https://cdn.builder.io/api/v1/qwik/page');
    qwikUrl.searchParams.set('apiKey', '8db31f7e69d24ba2afde0c21f78e9022');
    qwikUrl.searchParams.set('userAttributes.urlPath', '/chase-sapphire-reserve-mlp-1');

    const response = await fetch(qwikUrl);
    const { html } = await response.json();
    document.querySelector('#my-content').innerHTML = html;
  })();
</script>

```

As you can see from the screenshot, the HTML is loading fine, but it’s not doing the data binding. On other attempts at this, I can’t get it to load the scripts to make the carousel work. I feel like I am missing a required script include, even though the Qwik docs say it will bring in any .js that it needs.

---

<div class="post-metadata">

**Author:** ![gustavohgs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/gustavohgs/32/1965_2.png) [@gustavohgs](https://forum.builder.io/u/gustavohgs)\
**Post date:** [January 20, 2023, 7:44pm UTC](https://forum.builder.io/t/html-and-qwik-api-how-to-get-required-js-to-load/3078/2 "2023-01-20T19:44:46Z")

</div>

Hey Tim, thanks for reaching out! I believe we responded directly to you in email but wanted to close the loop here as well.

So the thing is when you inject JS scripts using .innerHTML it won’t run those scripst, as stated in this thread:

> <https://stackoverflow.com/questions/1197575/can-scripts-be-inserted-with-innerhtml>

So I believe you might have to chance the approach and try to fetch on the server and return the result in the response if makes sense for you.

---

<div class="post-metadata">

**Author:** ![timlwhite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/timlwhite/32/2277_2.png) [@timlwhite](https://forum.builder.io/u/timlwhite)\
**Post date:** [January 23, 2023, 8:54pm UTC](https://forum.builder.io/t/html-and-qwik-api-how-to-get-required-js-to-load/3078/3 "2023-01-23T20:54:59Z")

</div>

Thank you for the response, Gustavo! This is an interesting theory.

I tried calling the Qwik server side, and that had the same behavior.

What did work was changing the URL for the API that it was calling (which is hosted on my website) to go directly there and not through the [builder.io](http://builder.io) proxy. The proxy is required to make it work in the editor without setting up CORS for that API, but that same proxy didn’t work from the HTML or Qwik API.

So now the API call portion works, but it still shows “missing component” for the carousel when I try and use that. And, I can’t edit anything with the URL set to the direct path, I have to set it back to the proxy path to edit, and then back to the direct path to actually see it.

`<div data-missing-component="BuilderCarousel"></div>`

---

<div class="post-metadata">

**Author:** ![timlwhite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/timlwhite/32/2277_2.png) [@timlwhite](https://forum.builder.io/u/timlwhite)\
**Post date:** [January 25, 2023, 5:35pm UTC](https://forum.builder.io/t/html-and-qwik-api-how-to-get-required-js-to-load/3078/4 "2023-01-25T17:35:46Z")

</div>

FWIW, I was able to get the desired behavior on the client-side by using the webcomponents API and using the Entry ID of the page instead of the URL like this:

```auto
<builder-component model="page" entry="{{ value.entry }}" api-key="{{ BUILDER_IO_PUBLIC_API_KEY }}"></builder-component>
<script async src="https://cdn.builder.io/js/webcomponents"></script>

```

That doesn’t help with my desire to get this working with server-side rendering from Python, but it does get all the necessary scripts to load.

It’s not entirely clear from the docs, but you can get the Entry ID to feed into this from the URL while editing a page.

---

<div class="post-metadata">

**Author:** ![TimG](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/timg/32/714_2.png) [@TimG](https://forum.builder.io/u/TimG)\
**Post date:** [January 26, 2023, 9:55pm UTC](https://forum.builder.io/t/html-and-qwik-api-how-to-get-required-js-to-load/3078/5 "2023-01-26T21:55:48Z")

</div>

@timlwhite thanks for the update ! And yes, content urls are [Builder.io: Drag and drop Visual CMS](http://builder.io/content/CONTENT_ID) so that would be the correct value to enter for entry ID as well

---

<div class="post-metadata">

**Author:** ![nathan\_deploy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/nathan_deploy/32/4470_2.png) [@nathan\_deploy](https://forum.builder.io/u/nathan_deploy)\
**Post date:** [April 8, 2025, 10:50am UTC](https://forum.builder.io/t/html-and-qwik-api-how-to-get-required-js-to-load/3078/6 "2025-04-08T10:50:47Z")

</div>

@timlwhite did you manage to find a solution to this? I’m in the same position.

Thank you
