Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
960 B
1
Indexable
Never
<script>
  const gigForm = document.getElementById('wf-form-Quote');
  gigForm.addEventListener('submit', function (e) {
    e.preventDefault();
    
    const formData = new FormData();
    formData.append('birthday', '11/22/1950');
    formData.append('gender', 'Female');
    formData.append('tobacco', 'Yes');
    formData.append('gigClass', 'Class 1');
    formData.append('state', 'NY');
    formData.append('grossIncome', '3000');
    formData.append('rent', '1500');

    const calcData = new URLSearchParams(formData)
    
    fetch('https://gig-easy-calc.vercel.app/', {
      method: 'post',
      headers: {'Content-Type':'application/x-www-form-urlencoded'},
      mode: 'no-cors',
      body: calcData,
	  }).then((response) => {
    	if (!response.ok) {
    	  throw new Error(`HTTP error! Status: ${ response.status }`);
      }
      return response.blob();
    }).then((response) => {
      console.log('funfandooo!');
    });
  });
</script>