JSFiddle - React, Tailwind, and code Playground
by technik300
HTML
<!DOCTYPE html>
<html>
<head>
<title>FETCH</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=5.0, user-scalable=yes">
<style>
html{}
body{}
</style>
</head>
<body>
<button onclick="_get(url)">get</button>
</body>
</html>
JavaScript
let url ='https://card.wb.ru/cards/detail?spp=18®ions=68,64,83,4,38,80,33,70,82,86,75,30,69,22,66,31,48,1,40,71&pricemarginCoeff=1.0®=1&appType=1&emp=0&locale=ru&lang=ru&curr=rub&couponsGeo=12,3,18,15,21&dest=-1029256,-102269,-1278703,-1255563&nm=110383570';
console.dir( JSON.parse('{"state":0,"data":{"products":[{"id":110383570,"root":100616778,"kindId":0,"subjectId":4088,"subjectParentId":657,"name":"Фреза для маникюра Фреза алмазная","brand":"Konucci","brandId":161396,"siteBrandId":171396,"supplierId":354144,"priceU":199900,"sale":85,"salePriceU":29900,"extended":{"basicSale":85,"basicPriceU":29900},"pics":5,"rating":0,"feedbacks":0,"isNew":true,"colors":[],"sizes":[{"name":"","origName":"0","rank":0,"optionId":200493483,"stocks":[{"wh":120762,"qty":196}],"time1":7,"time2":22,"wh":120762}],"diffPrice":false,"time1":7,"time2":22,"wh":120762}]}}')
);
function _get(url){
console.log('_get');
fetch(url, {mode: 'no-cors',
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.5',
'Cache-Control': 'max-age=0',
'Connection': 'keep-alive',
'Host': 'card.wb.ru',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'none',
'Sec-Fetch-User': '?1',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0'
}
}).then(function (response) {
console.log(response.data);
console.log(response.status);
console.log(response.statusText);
console.log(response.headers);
console.log(response.config);
});
}