将Javascript变量的值发送到Go变量中

I need to read the value of a Javascript variable (JS2GO) in my Go code (v.Hostname). I do not know how to do it.

I have read a bit about syscall/js but I could not find anything.

It is the Javascript code:

    $(document).on("keypress", "input", function(e){
      if(e.which == 13){
          var JS2GO = $(this).val();
      }
    });

And here is the form I have in my .gohtml file.

    <form method="POST">
      <input id="myInput" type="text" name="host">
      <input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;" tabindex="-1">
    </form>

P.S.

I came up with this solution because I can't click on "submit" button (it is hidden), then it doesn't send the results to my Go code. It means that I cannot read the value of input by this code: v.Host = r.FormValue("host"). Please let me know if my approach is not optimal.

Based on comment of @G.aziz, I have found a solution mentioned here. In my case, it got fixed in this way:

<form method="POST">
    <input id="myInput" type="text" name="host" style="min-width: 220px;" placeholder="Hostname; e.g. crowe.org">
    <input id="submitBtn" type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;" tabindex="-1">
</form>

and the Ajax code:

$(document).ready(function () { 
    $('#submitBtn').click(function () {
        $.ajax({
          url: '/',
          type: 'POST',
          dataType: 'HTML',
          data : {
            ajax_post_data: $('#myInput').val()
          },
        });
     });
});

Then in my Go file, I can get the value like this

if r.Method == "POST" {
    v.Host = r.FormValue("ajax_post_data")
}