Jump to content

JamesJ

Member
  • Posts

    7
  • Joined

  • Last visited

Posts posted by JamesJ

  1. 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']
    ]

  2. 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> 
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.