How can I change html using Go?

I have searched for a solution that changes the html dynamically. Like this jQuery: https://jsfiddle.net/9mo4aezr/2/

It should be possible using goquery, but I cannot find the syntax for this. Or is it possible without goquery?

I tried this code using goquery without success:

func addhtml() {
	doc, err := goquery.NewDocument("http://127.0.0.1:6060/mainwin")
	if err != nil {
		log.Fatal(err)
	}

	doc.Find("#subwin").Add("test")
}

I have now done som tests.

  1. AJAX gives only data - no HTML
  2. Storing all contents in the table gives data - no HTML
  3. iFrame gives you both data and HTML and you can do a simple database lookup from an id

http://94.237.92.101:6060/newposts (note that you need a bigger screen 1800px+)

HTML

<tr data-id={{.post_id}}>
<iframe id="subwin" src=""></iframe>
<script>const url = 'c_post?id=';</script>

Javascript

const selected = table.getElementsByClassName('selected')
table.onclick = sel;
function sel(row) {
  if (row.target.parentNode.dataset.id > 0) {
    if (selected[0]) selected[0].className = '';
    row.target.parentNode.className = 'selected';
    const el = document.querySelector('selected');
    document.getElementById('subwin').src = (url + row.target.parentNode.dataset.id);
  }
}

Is there really no other ways to populate an area with both HTML and data without using iFrame?

Websockets may be a solution, but it seems to be overkill. Or?

Is it possible to use goquery?