Skip to content

Instantly share code, notes, and snippets.

@andresgallo
Last active October 15, 2025 05:12
Show Gist options
  • Select an option

  • Save andresgallo/f948163e205f4a5d5b4e5fed24e8bd13 to your computer and use it in GitHub Desktop.

Select an option

Save andresgallo/f948163e205f4a5d5b4e5fed24e8bd13 to your computer and use it in GitHub Desktop.
var elForm = document.querySelector('bsp-form[data-anchor] form')
var elUrl = new URL(elForm.action)
elUrl.searchParams.append('_someKey', 'clearCache')
elUrl.searchParams.append('_renderer', 'styleguide')
console.log('ELURL', elUrl)
fetch(elUrl, {
method: 'POST',
body: new FormData(elForm)
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json(); // Parse the JSON response
})
.then(data => {
window.fakeDoc = document.createElement('div')
window.fakeDoc.innerHTML = data
// Update your UI based on the response
})
.catch(error => {
console.error('Error:', error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment