const detailsData = $('form').serializeArray()
let details = {};
for (let i = 0; i < detailsData.length; i++) {
details[detailsData[i]['name']] = detailsData[i]['value'];
}
var formData = {
'details': details,
'items': JSON.parse(Cookies.get('basket')),
'visitor': <?php echo (!empty($visitor)) ? json_encode($visitor) : null; ?>
};
console.log(formData);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="js/slick.min.js"></script>
<script src="js/main.js"></script>
<link rel="stylesheet" href="css/main.css" id="theme1">
let switchMode = document.getElementById("theme");
switchMode.onclick = function() {
let theme = document.getElementById("theme1");
if (theme.getAttribute("href") === "css/main.css") {
theme.setAttribute("href", "css/main_dark.css");
console.log(1);
} else {
theme.setAttribute("href", "css/main.css");
console.log(0);
}
}
async function getResponse() {
let response = await fetch('https://dummyjson.com/products')
let jsonList = await response.json()
let list = document.querySelector('.products')
let key
let elements = jsonList.products
elements = elements.splice(0, 3)
for (key in elements) {
function getPictures() { //вывод ключей на картинки
let images = ''
for (let i = 0, length = elements[key].images.length; i < length; i++) {
images += `<img src="${elements[key].images[i]}" alt="${elements[key].description}" />`
}
return images
}
list.innerHTML +=
`<li class="item">
<h5 class="small_panel">${elements[key].title}</h5>
<div class="full_panel">
${getPictures()}
<p>brand: ${elements[key].brand}</p>
<p>category: ${elements[key].category}</p>
<p>${elements[key].description}</p>
<p>discount percentage: ${elements[key].discountPercentage} %</p>
<p>price: ${elements[key].price} usd</p>
<p>rating: ${elements[key].rating}</p>
<p>stock: ${elements[key].stock}</p>
</div>
</li>`
}
}
getResponse()
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>123</title>
</head>
<body>
<input type="number" id="input">
<span id="btn" onclick="btn()">Подтвердить</span>
<div class="timeProgress">
<input value="0" class="CNF">
<h3><span id="result">0</span>/3</h3>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script src="https://website-about.neocities.org/arcana/knob/jquery.knob.min.js"></script>
<script type="text/javascript">
let result_txt = document.getElementById('result');
function btn() {
var value_input = document.getElementById("input").value;
// Меняем значение кноба и инициализируем (trigger) перерисовку
$('.CNF')
.val(value_input)
.trigger('change');
result_txt.innerHTML = value_input;
}
$(document).ready(function() {
$(".CNF").knob({
'min': 0,
'max': 3,
'readOnly': true,
'width': '100%',
'thickness': 0.2,
'displayInput': false,
'bgColor': 'lightskyblue',
'fgColor': 'navy',
'angleOffset': 0,
'angleArc': 360
})
})
</script>
</body>
</html>
<div id="tab_1">
...
<button id="tab_1_submit">Перейти к табу 2</button>
</div>
<div id="tab_2">
...
<button id="tab_2_submit">Перейти к табу 3</button>
</div>
const requiredFields = document.getElementById('tab_1').querySelectorAll('[required]')
const requiredFields = $('#tab_1 [required]')
Получается, что из radio он находит только первый пол мужской, а элемент женский не читает, хотя он тоже считается required.
Нужно, чтобы он проверял любой пол.
UPDATE `table` SET `field_name` = replace(field_name, 'http://site1.ru', 'http://site2.ru')
const fetch = require('node-fetch');
module.exports = async () => {
return fetch(URL, {
method: 'POST',
headers: {
'Content-Type': 'application/xml'
}
})
.then((res) => {
return res
})
}
const postRequest = require('./postRequest');
postRequest()
.then(function (res) {
console.log(res);
})