input: def submitForm(event):
      """
      This function handles the form submission, preventing the default action,
      collecting the city input, preparing a JSON object, and sending it to the server.
      
      :param event: The event object from the form's onsubmit event
      :return: None
      """
      event.preventDefault();
  
      const form = document.getElementById('myForm');
      const city = form.querySelector('input[name="city"]').value;
  
      const data = { city: city };
  
      const options = {
          method: 'POST',
          body: JSON.stringify(data),
          headers: {
              'Content-Type': 'application/json'
          }
      };
  
      fetch('/my-api/submit-form', options)
          .then(response => response.json())
          .then(data => {
              console.log(data);
          });
output:     event.preventDefault();
  
      const form = document.getElementById('myForm');
      const city = form.querySelector('input[name="city"]').value;
  
      const data = { city: city };
  
      const options = {
          method: 'POST',
          body: JSON.stringify(data),
          headers: {
              'Content-Type': 'application/json'
          }
      };
  
      fetch('/my-api/submit-form', options)
          .then(response => response.json())
          .then(data => {
              console.log(data);
          })
          .catch(error => {
              console.error('Error:', error);
          });