Skip to content

Instantly share code, notes, and snippets.

@zuzannamj

zuzannamj/hideSpinner.html

Last active Mar 27, 2020
Embed
What would you like to do?
<script>
function showSpinner() {
$spinner = document.getElementsByClassName("slds-spinner_container")[0];
$spinner.style.display = "block";
}
function hideSpinner() {
$spinner.style.display = "none";
}
...
function postData() {
fetch("http://example.com/myData.json", {
method: "POST",
headers: {
...
},
body: ({
...
})
}).then(function(res) {
hideSpinner(), window.alert("Success")
}).catch(function(err) {
hideSpinner(), window.alert("Error")
})
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.