show alert after changing
This commit is contained in:
12
index.html
12
index.html
@@ -72,7 +72,12 @@
|
|||||||
fetch(URL, { method: "POST" })
|
fetch(URL, { method: "POST" })
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log(data)
|
console.log("server response:" + data)
|
||||||
|
if (data.success) {
|
||||||
|
alert("Track changed successfully!");
|
||||||
|
} else {
|
||||||
|
alert("Failed to change track: " + data.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +127,11 @@
|
|||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
console.log("Server response:", data);
|
console.log("Server response:", data);
|
||||||
|
if (data.success) {
|
||||||
|
alert("Cars changed successfully!");
|
||||||
|
} else {
|
||||||
|
alert("Failed to change cars: " + data.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user