communicating variables between go and javascript

Writing a website connected to a Go backend

I am able to pass data to the html template and thus the front end but can not then use that data for a am missing the code skill in javascript.

How can a Go variable


be read by javascript code?


  • This can probably be done by storing the variables in a file rather than in the scripts local storage.

    When You want to read variable then grab the value from the file and when you want to set variable then write to the file.

    The value can be stored in a .txt file but if u have a lot of values that are going to be stored and passed between the programs consider making a .json File.