This is what I have tried so far, but it doesn't seem to work.
      var myJSON = JSON.stringify(distMatrix);
      var testform = `<form id="jsform" action="test.php" >
        <input type="hidden" name="array" value="${myJSON}"> /
      </form>`
      var printdata = document.getElementById('jsform');
      document.write(printdata);
      document.getElementById('jsform').submit();
 
     
    