x

JavaScript connection to API

Can I embed JavaScript code to pull JSON data from an API? I really need this functionality for my site to work.

1,489 Views
Message 1 of 2
Report
1 REPLY 1

Hello @AJSatori

Sure you can...

While in the Weebly Editor and working on your site, visit the page you want to add the JavaScript code.
Then, just drag the Weebly "Embed Code" element from the tray to a location on your page (I would recommend placing this somewhere out of the way and easy to remember). Finally, click that new instance and add some inline JavaScript ( here's what I used, then I published my site and as expected, I saw the "I AM HERE" in my browser's DevTools->Console:

<script type="text/javascript">
console.log('I AM HERE');
</script>


Of course, this isn't the only way you can add JavaScript to your site, you can also:

1. Build a Snippet App (that loads code you create on every page of your site)

2. Customize Your Site's Theme (although I recommend against this because once you customize your theme...we no longer support issues you encounter with your site).

Does this help?

1,465 Views
Message 2 of 2
Report