Answer the question
In order to leave comments, you need to log in
How to calculate customer amount using Ajax?
Good afternoon everyone :)
There was such a problem: there is an initial balance of the client, which is displayed on the page thanks to this code:
let getJson = {"balanse": 100000};
document.getElementById('header-item--balance').innerHTML = getJson.balanse;
<form action="#" class="data-item__form">
<h2 class="data-item__text" >Сумма</h2>
<input type="number" name="sum" id="sum" autocomplete="off" onkeyup="this.value = this.value.replace (/\D/gi, '').replace (/^0+/, '')">
</form>
let getJson = {"balanse": 100000};
document.getElementById('header-item--balance').innerHTML = getJson.balanse;
<form action="#" class="data-item__form">
<h2 class="data-item__text" >Сумма</h2>
<input type="number" name="sum" id="sum" autocomplete="off" onkeyup="this.value = this.value.replace (/\D/gi, '').replace (/^0+/, '')">
</form>
let btn = document.querySelector('.btn');
const form = document.querySelector('.data-item__form');
let inputs = document.querySelectorAll('input');
btn.addEventListener('click', () =>{
function getCheck(){
if (getKey() != "" && check.checked){
console.log('click')
btn.disabled = false;
const user = [...document.querySelectorAll('input')].reduce((user, el) => {
user[el.name] = el.value;
return user;
}, {});
getData();
btnClear();
//document.querySelectorAll('.table-container__data').innerHTML = JSON.stringify(user, null, '');
} else {
btn.disabled = true;
}
}
getCheck()
});
let xTable = document.getElementById('TableforData');
let tr = document.createElement('tr');
tr.innerHTML = '<td>' + item_sum + '</td><td>' + item_number + '</td><td>' + item_name + '</td><td>' + item_date + '</td><td>' + item_cvv +'</td>';
xTable.children[0].appendChild(tr);
const btnClear = () => {
for (let i = 0; i < inputs.length; i++) {
if(i) {
inputs[i].value = "";
}
}
};
class Balance {
get balance() {
return
}
set()
add()
}
balanse = new Balance()
class Money {
amount: 100000,
}
balanse.fetch()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question