diff --git a/res/app.js b/res/app.js index a495dec..5688d19 100755 --- a/res/app.js +++ b/res/app.js @@ -338,8 +338,10 @@ $(document).ready(function () { // Get the name of the difficulty var diff = $(this).attr("diff"); - // Get the value of the input named "filePath" - var filePath = $("input[name='filePath']").val(); + var parentFormId = $(this).closest("form").attr("id"); + var parentFormClass = $(this).closest("form").attr("class"); + + var filePath = $(`#${parentFormId} input[name='filePath']`).val(); // Construct the URL for the GET request var url = "/saveCharacter.php?cmd=wp&name=" + name + "&value=" + value + "&filePath=" + filePath + "&diff=" + diff; @@ -362,8 +364,12 @@ $(document).ready(function () { // Get the name of the difficulty var diff = $(this).attr("diff"); - // Get the value of the input named "filePath" - var filePath = $("input[name='filePath']").val(); + + var parentFormId = $(this).closest("form").attr("id"); + var parentFormClass = $(this).closest("form").attr("class"); + + var filePath = $(`#${parentFormId} input[name='filePath']`).val(); + // Construct the URL for the GET request var url = "/saveCharacter.php?cmd=q&name=" + name + "&value=" + value + "&filePath=" + filePath + "&diff=" + diff; @@ -401,6 +407,7 @@ $(document).ready(function () { var cmd = $(this).attr("cmd") || $(this).attr("id") || name; var parentFormId = $(this).closest("form").attr("id"); var parentFormClass = $(this).closest("form").attr("class"); + var filePath = $(`#${parentFormId} input[name='filePath']`).val(); var url = constructURL(cmd, name, newValue, filePath);