Skip to content

Instantly share code, notes, and snippets.

@procarrera
Created February 18, 2022 13:45
Show Gist options
  • Save procarrera/f1bf2161152f3b222f03e89b9e526071 to your computer and use it in GitHub Desktop.
Save procarrera/f1bf2161152f3b222f03e89b9e526071 to your computer and use it in GitHub Desktop.
fetch and render sections from Shopify
async function renderSections(sectionsIDs: Array, targetElement){
const response = await fetch("/?sections=" + sectionsIDs.toString())
const sections = await response.json()
targetElement.innerHTML = ""
for(const section in sections){
targetElement.innerHTML += sections[section]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment