mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 08:24:24 -05:00
ajaxify d2s editor
This commit is contained in:
44
res/app.js
44
res/app.js
@@ -334,9 +334,9 @@ $(document).ready(function () {
|
||||
|
||||
// Get the name of the checkbox
|
||||
var name = $(this).attr("name");
|
||||
|
||||
|
||||
// Get the name of the difficulty
|
||||
var diff = $(this).attr("diff");
|
||||
var diff = $(this).attr("diff");
|
||||
|
||||
// Get the value of the input named "filePath"
|
||||
var filePath = $("input[name='filePath']").val();
|
||||
@@ -358,9 +358,9 @@ $(document).ready(function () {
|
||||
|
||||
// Get the name of the checkbox
|
||||
var name = $(this).attr("name");
|
||||
|
||||
|
||||
// Get the name of the difficulty
|
||||
var diff = $(this).attr("diff");
|
||||
var diff = $(this).attr("diff");
|
||||
|
||||
// Get the value of the input named "filePath"
|
||||
var filePath = $("input[name='filePath']").val();
|
||||
@@ -376,5 +376,41 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
// Get the value of the input named "filePath"
|
||||
function constructURL(cmd, name, value, filePath) {
|
||||
return "/saveCharacter.php?cmd=" + cmd + "&name=" + name + "&value=" + value + "&filePath=" + filePath;
|
||||
}
|
||||
|
||||
$(".charform input[name='Difficulty'], .charform .skill, #CharacterName, #CharacterClass, #CharacterLevel, #CharacterClass").change(function () {
|
||||
var name = $(this).attr("name");
|
||||
var newValue = $(this).val();
|
||||
|
||||
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);
|
||||
|
||||
console.log(url);
|
||||
console.log(newValue)
|
||||
|
||||
|
||||
$.get(url, function (response) {
|
||||
if (cmd == 'CharacterName') {
|
||||
location.reload();
|
||||
}
|
||||
console.log(response);
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});// end document.ready
|
Reference in New Issue
Block a user