Javascript onclick event that shows result after a form.submit

function showResult(e){
    // Stop the default form submission

    // Make a POST request to your server sending the form 
    fetch("/",{ method: "POST", body: new FormData(document.querySelector('form')})

    .then(function(result) { // This is the response from the server
       return result.json();
      // Process the returned data
      // Make your frame visible
      document.getElementById('result').style.visibility = 'visible'