Last active
October 15, 2025 05:12
-
-
Save andresgallo/f948163e205f4a5d5b4e5fed24e8bd13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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