1function checkDirect(form) { 2 let fields = { 3 fname: document.getElementsByName('First Name')[0]?.value ?? '', 4 lname: document.getElementsByName('Last Name')[0]?.value ?? '', 5 email: document.getElementsByName('E-mail Address')[0]?.value ?? '', 6 zipcode: document.getElementsByName('Home Postal Code')[0]?.value ?? '', 7 preferredLocation: 8 document.getElementsByName('preferred_location')[0]?.value ?? '', 9 }; 10 11 if (Object.values(fields).every((x) => x != '')) { 12 form.submit(); 13 const formData = new FormData(form); 14 const data = {}; 15 formData.forEach((value, key) => { 16 const all = formData.getAll(key); 17 data[key] = all.length > 1 ? all.join(', ') : value; 18 }); 19 20 fetch('/api/leads', { 21 method: 'POST', 22 headers: { 23 'Content-Type': 'application/json', 24 }, 25 body: JSON.stringify(data), 26 }).then((res) => res.json()) 27 .then((response) => { 28 console.log('Lead successfully submitted:', response); 29 }) 30 .catch((error) => { 31 console.error('Error submitting lead:', error); 32 }); 33 34 setTimeout(function () { 35 window.location = redirectURL; 36 }, 1800); 37 ga(function () { 38 var trackers = ga.getAll(); 39 for (var i = 0; i < trackers.length; ++i) { 40 var tracker = trackers[i]; 41 ga(tracker.get('name') + '.send', 'event', { 42 eventCategory: 'form_submit', 43 eventAction: eventActionType, 44 eventLabel: eventLabelType, 45 }); 46 } 47 }); 48 } else { 49 alert('Please fill out all required fields'); 50 var submitBtn = document.getElementsByName('Submit')[0]; 51 submitBtn.style.visibility = 'visible'; 52 } 53}
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.