JakeChampion / fetch

A window.fetch JavaScript polyfill.

Home Page:http://github.github.io/fetch/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

code is working in chrome, not in firefox

schoormans opened this issue · comments

the data that is put in the html form, is send through a php file to store in a json file. when the user, has paid, they are send to a php file the php file takes the data out of the json file and uses it. it is working great in chrome. but in firefox the data is not being send.
here is my html form and the
`



Naam:

Datum:

Email:

<script type="text/javascript"> function showIt(imgsrc) { document.getElementById('imageshow').src=imgsrc; } function hideIt() { document.getElementById('imageshow').src="images1/lege paspop W2.jpeg"; } </script>

Taillewijdte (in mm):

Heupwijdte (in mm):

Heuphoogte (in mm):

Bovenwijdte (in mm):

Lichaamslengte (in mm):

Bustediepte (in mm):

                                     


<script> function saveFile() { // Collect form data const naam = document.querySelector('input[name="Naam"]').value; const datum = document.querySelector('input[name="Datum"]').value; const email = document.querySelector('input[name="Email"]').value; const tailleWijdte = document.querySelector('input[name="TailleWijdte"]').value; const heupWijdte = document.querySelector('input[name="HeupWijdte"]').value; const heupHoogte = document.querySelector('input[name="HeupHoogte"]').value; const bovenWijdte = document.querySelector('input[name="BovenWijdte"]').value; const lichaamsLengte = document.querySelector('input[name="LichaamsLengte"]').value; const busteDiepte = document.querySelector('input[name="BusteDiepte"]').value; // Create a JavaScript object to hold the form data const formData = { Naam: naam, Datum: datum, Email: email, TailleWijdte: tailleWijdte, HeupWijdte: heupWijdte, HeupHoogte: heupHoogte, BovenWijdte: bovenWijdte, LichaamsLengte: lichaamsLengte, BusteDiepte: busteDiepte, }; // Send the data to the server as JSON fetch("zzsave_data13shirt.php", { method: "POST", body: JSON.stringify(formData), headers: { "Content-Type": "application/json", }, mode: "cors", // Add this line }) .then((response) => { if (response.ok) { // Successful response, you can handle it here console.log("Data saved successfully"); } else { // Handle errors here console.error("Error:", response.status, response.statusText); } }) .catch((error) => { console.error("Error occurred during fetch:", error); // Log the error details for further debugging }); } </script>`

This doesn't look like an issue related to this fetch polyfill to me