Загрузка данных


fetch('/api.php', {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    action: 'quick_buy',
    product_id: 1,
    quantity: -300,
    unit_price: 490
  })
}).then(r=>r.json()).then(d=>{
  console.log('Баланс:', d.new_balance);
  location.reload();
})