var goRespon
, как в js console.log if (xhr.status === 200) {
if (xhr.getResponseHeader('X-Resp') === true) {
document.querySelector('#span_1').innerHTML = xhr.response;
} else {
document.querySelector('#span_2').innerHTML = xhr.response;
}
}
<form>
<span>Введите дату:</span>
<input />
<span id="span"></span> <!-- Здесь ответ от сервера в зависимости от условия if else -->
<button type="submit">Отправить</button>
</form
document.querySelector('#span').innerHTML = xhr.response;
let imagefile = await page.evaluate(async () => {
let imagefile
try {
document.querySelectorAll('div.item-wrapper img');
} catch(e) {
imagefile = null
}
return imagefile
})
for(let i = 0; i < imgfile.lenght; i++) {
let imagefileDL = await page.goto(imagefile[i].src);
fs.writeFile('./uploads/' + imagefile[i].src.replace(/^.*[\\\/]/, ''), await imagefileDL.buffer(), function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
}
app.use(express.static(path.resolve(__dirname, 'public')));
href='/css/layout.css'
// ... и т.д
<button class="add-to-db">Обновить</button>
<script>
document.addEventListener("DOMContentLoaded", function () {
let button = document.querySelector('.add-to-db');
button.addEventListener('click', function () {
alert(1)
})
});
</script>