PageSourceSearch

https://www.nickwatch.com/app/themes/nickelodeon/assest/js/freshdesk-form.js?ver=1791087033

js nickwatch.com collected 2026-10-04 05:23:46 UTC 2,380 bytes, 73 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2  const form = document.querySelector('.hf-form');
3  if (!form) return;
4
5  // prevent double binding
6  if (form.dataset.fdBound) return;
7  form.dataset.fdBound = '1';
8
9 const submitBtn = form.querySelector('.submit');
10
11  form.addEventListener('submit', function (e) {
12    //e.preventDefault();       // stop WP email
13    //e.stopImmediatePropagation();
14
15    // 🔒 Disable submit button
16  
17    const fd = new FormData();
18
19    fd.append('name', form.querySelector('[name="name"]')?.value || '');
20    fd.append('email', form.querySelector('[name="emailAddress"]')?.value || '');
21    fd.append('phone', form.querySelector('[name="phone"]')?.value || '');
22    fd.append('imei', form.querySelector('[name="deviceId"]')?.value || '');
23    fd.append('topic', form.querySelector('[name="issueType"]')?.value || '');
24    fd.append('message', form.querySelector('[name="description"]')?.value || '');
25    fd.append('priority', 'Low');
26
27    // Operating system
28    const os = form.querySelector('[name="phoneOS_EN"]')?.value || '';
29    fd.append('Phone_operating_system', os);
30
31    // Place of purchase
32    fd.append(
33      'place_of_purchase',
34      form.querySelector('[name="purchaseLocation_EN"]')?.value || ''
35    );
36
37    // ✅ attachment
38    const fileInput = form.querySelector('input[type="file"]');
39    if (fileInput && fileInput.files.length > 0) {
40      fd.append('attachment', fileInput.files[0]);
41    }
42
43    fetch('https://trackimo.com/loc8-api/freshdesk-ticket-nickwatch.php', {
44      method: 'POST',
45      body: fd,   // ⚠️ NO Content-Type header (browser sets it)
46    })
47      .then(res => res.json())
48      .then(data => {
49        if (!data.success) throw data;
50
51        // ✅ Show success banner
52        const success = document.querySelector('.banner--success');
53        if (success) {
54          //success.style.display = 'block';
55          //success.scrollIntoView({ behavior: 'smooth' });
56        }
57
58        form.reset();
59      })
60      .catch(err => {
61        console.error('Freshdesk error:', err);
62        //alert('Something went wrong. Please try again.');
63      })
64       .finally(() => {
65        // 🔓 Re-enable button
66        if (submitBtn) {
67          submitBtn.disabled = false;
68          submitBtn.style.opacity = '1';
69          submitBtn.value = 'SEND';
70        }
71      });
72  }, true);
73});

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.