1window.WebForm = function(form){ 2 form.addEventListener("submit", function(e){ 3 const uuid = form.getAttribute('id'); 4 e.preventDefault(); 5 const formData = new FormData(e.target); 6 7 let url = '/bitrix/services/main/ajax.php?c=composer:ranepa.form&mode=class&action=add'; 8 9 const xhr = new XMLHttpRequest(); 10 11 xhr.onload = () => { 12 13 form.querySelector('[type="submit"]').disabled = false; 14 if (xhr.status >= 200 && xhr.status < 300) { 15 const response = JSON.parse(xhr.responseText); 16 if ( response.status == 'success' ) { 17 if (document.querySelector('[data-modal="' + uuid + '"]')){ 18 appModals.close(uuid); 19 } 20 setTimeout(function () { 21 appModals.open(uuid + '-success'); 22 }, 100); 23 form.reset(); 24 25 } else { 26 27 document.querySelector('#' + uuid + '-not-success h2').innerHTML = "ÐÑоизоÑла оÑибка"; 28 document.querySelector('#' + uuid + '-not-success p').innerHTML = response.errors[0].message; 29 30 if (document.querySelector('[data-modal="' + uuid + '"]')){ 31 //appModals.close(uuid); 32 } 33 34 setTimeout(function () { 35 appModals.open(uuid + '-not-success'); 36 }, 100); 37 } 38 } 39 }; 40 xhr.onerror = function (e) { 41 console.log('error'); 42 }; 43 xhr.ontimeout = function (e) { 44 console.log('timeout'); 45 }; 46 xhr.open('POST', url, true); 47 xhr.send(formData); 48 49 }) 50}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.