Javascript onclick event that shows result after a form.submit

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

    // 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();
    })
    .then(function(data){ 
      // Process the returned data
      ......
      // Make your frame visible
      document.getElementById('result').style.visibility = 'visible'
    })
 }