https://developer.mozilla.org/ru/docs/Web/API/Fetch_API
https://developer.mozilla.org/ru/docs/Web/API/Response
https://learn.javascript.ru/fetch
https://learn.javascript.ru/fetch-api
https://habr.com/ru/post/252941/
Введение в fetch
https://github.com/github/fetch
window.fetch polyfill
		
function sendForm(n) {
	let obj = Object.fromEntries(calculatorMap);
	fetch("/calculator/mail.php", {
		method: 'post',
		body: JSON.stringify({ items: obj, name: n.name.value, phone: n.phone.value, code: n.code.value }),
		headers: {
			'Content-Type': 'application/json'
		}
	}).then(function (response) {
		return response.text();
	}).then(function (text) {
		if (text === 'ok') {
			ym(51755942, 'reachGoal', 'calculator');
			alert('Спасибо! Ваша заявка получена, мы свяжемся с Вами в ближайшее время.');
			n.classList.remove('codesent');
			n.reset();
		} else {
			alert(text);
		}
	}).catch(function (error) {
		log('Request failed', error)
	});
}