JavaScript
7
Вклад в тег
<input type = "text" id = "inputTovar">
<div id = "priceLevel"></div>
document.getElementById('inputTovar').oninput = function() {
if (document.getElementById('inputTovar').value > 5) {
document.getElementById('priceLevel').innerHTML = 'Оптовая цена';
}
else {
document.getElementById('priceLevel').innerHTML = 'Розничная цена';
}
}
document.addEventListener('DOMContentLoaded', docReady);
function docReady()
{
let data = JSON.stringify({
"modelName": "TrackingDocument",
"calledMethod": "getStatusDocuments",
"methodProperties":
{
"Documents":
[
{
"DocumentNumber": id,
"Phone": ""
}
]
}
});
data = 'data=' + data + '&apiKey=' + '';
let response = fetch(
'https://api.novaposhta.ua/v2.0/json/',
{
method: 'POST',
headers:
{
'Content-Type': 'application/json; charset=utf-8'
},
body: data
}
)
.then(function(response)
{
response.text().then(function(text)
{
data = text;
});
});
}