JamesJ
-
Posts
7 -
Joined
-
Last visited
Content Type
Forums
Gallery
Blogs
Events
Store
Downloads
Profiles
Posts posted by JamesJ
-
-
I am attempting to set an array equal to an external JSON file. I put the JSON file on google drive and set it to share. I have tried many different examples of code to get the JSON data into the array, but I am stymied. Thanks for any help.
-
Fantastic! Thanks bangank36! That did the trick.
-
Site URL: https://www.waileage.org/test
I have attempted to freeze the top row and first column in the table generated from javascript. I have tried editing the css and javascript to force the top row and first column not to scroll, but without success. I looked through the forum, but couldn't find anything related to the problem I am encountering. Any suggestions would be greatly appreciated. Thanks.
-
-
Hi tuanphan,
Thanks for offering to take a look at the site. This is the page - https://www.waileage.org/test. The code block is above the text on the page, but nothing is displayed.
Kind regards,
James
-
I am trying to get a simple javascript array to pass to a squarespace page, but everything I have tried has not worked. Here is the latest code I attempted. I put the script in the Advanced code section for the page, and the HTML in a code section on the page. I can't get anything to display. I am using squarespace 7.1. Any help would be greatly appreciated. Thanks!
in advanced code section... <script> var array = ['apple','ball']; document.getElementById('content').innerHTML = array.toString(); </script> in code section on page <div id="content"></div>
Setting a constant equal to an external JSON file
in Customize with code
Posted · Edited by JamesJ
Thanks for the response method.
I did try this code to read the following simple json file. I uploaded the file to the squarespace site rather than trying to call it from google drive.
<script>
fetch('https://www.waileage.org/s/testdata.json')
.then(response => response.json())
.then(data => console.log(data));
document.getElementById("container").innerHTML = data;
</script>
json file = [
['apple', 'fruit', 'red'],
['pear', 'fruit', 'yellow'],
['carrot', 'vegetable', 'orange'],
['eggplant', 'vegetable', 'purple']
]