[ai] new option on how to continue for mapping

This commit is contained in:
2025-08-09 22:59:40 +02:00
parent ce863f4d02
commit 02cd5da886
4 changed files with 244 additions and 25 deletions

View File

@@ -164,13 +164,17 @@ function playNamedSong(song) {
function editMapping() {
var rfid = document.getElementById('rfid').value;
var song = document.getElementById('song').value;
var modeEl = document.getElementById('mode');
var mode = modeEl ? modeEl.value : 's';
var xhr = new XMLHttpRequest();
xhr.open("POST", "/edit_mapping", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xhr.send("rfid=" + encodeURIComponent(rfid) + "&song=" + encodeURIComponent(song));
xhr.send("rfid=" + encodeURIComponent(rfid) + "&song=" + encodeURIComponent(song) + "&mode=" + encodeURIComponent(mode));
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
alert("Mapping updated successfully!");
} else if (xhr.readyState === 4) {
alert("Failed to update mapping: " + (xhr.responseText || xhr.status));
}
};
}