const apiKey = '6e2676fa4067aecefdfae6fca7c4bb41';
const formID = '231977694238068';
const table = document.getElementById("tabla");
   document.getElementById("submitDataBtn").addEventListener("click", function () {
    const tableData = table;
    sendDataToJotForm(tableData);
  });

  function extractTableData() {
    // Extract table data logic
  }

  function sendDataToJotForm(tableData) {
    const formData = new FormData();
    formData.append("submission[data][tableData]", JSON.stringify(tableData));

    fetch(`https://api.jotform.com/form/${formID}/submissions`, {
      method: 'POST',
      headers: {
        'APIKEY': apiKey,
      },
      body: formData,
    })
    .then(response => response.json())
    .then(data => {
      // Handle the API response if needed
      console.log(data);
    })
    .catch(error => {
      // Handle errors
      console.error('Error submitting data:', error);
    });
  }