diff --git a/static/js/add-spot.js b/static/js/add-spot.js
index dec7188..9c187f4 100644
--- a/static/js/add-spot.js
+++ b/static/js/add-spot.js
@@ -150,6 +150,9 @@ function loadCredentials(providerName) {
// Method called to add a spot to the server
function addSpot() {
try {
+ $("#result-bad").empty();
+ setSubmitting(true);
+
// Save settings (this will save "your call" for future use)
saveSettings();
@@ -214,6 +217,7 @@ function addSpot() {
}, 2000);
},
error: function (result) {
+ setSubmitting(false);
if (window._recaptchaWidgetId !== undefined) {
grecaptcha.reset(window._recaptchaWidgetId);
}
@@ -225,11 +229,19 @@ function addSpot() {
}
});
} catch (error) {
+ setSubmitting(false);
showAddSpotError(error);
}
return false;
}
+// Show or hide the "in progress" state on the Spot button.
+function setSubmitting(submitting) {
+ $("#add-spot-submit").prop("disabled", submitting);
+ $("#add-spot-spinner").toggle(submitting);
+ $("#add-spot-submit-text").text(submitting ? "Spotting..." : "Spot");
+}
+
// Show an "add spot" error.
function showAddSpotError(text) {
const div = $("