JS是唯一运行在客户端的技术(编程语言)。所以必须使用它。为什么不使用 AJAX 请求来修改你的后端呢?
$.ajax({
type: "POST",
url: url,
data: data,
success: () => {},
dataType: "json",
error: (error, typeError, cc) => {}
});
然后创建一个接受请求的文件,例如在 PHP 中
$field1 = $_POST['field1];
refreshValuesBackend($userReference, $field1, ...$otherFields);
然后创建
refreshValuesBackend()
来更新值。