$(document).ready(() => {
    $("#passwordChangeForm").submit(() => {
        $.ajax({
            type: "POST",
            url: "/api/changePassword",
            contentType: 'application/json',
            data: JSON.stringify({
                oldPassword: $("#oldPassword").val(),
                newPassword: $("#newPassword").val()
            }),
            success: () => {
                alert("Пароль изменён")
            },
            error: (xhr) => {
                alert(xhr.responseText);
            }
        });
    });
});