Update only part of template or call javascript function from backend

I have a registration form that processes the data in the back end and when user enters something like an invalid password length I parse an entire template and I pass in a string in the template which displays a error message to the user. This doesn’t seem efficient to me as I basically parse same html content again.

Is there a way for golang templates to manipulate DOM or call a JavaScript function or just to parse only a single template piece and keep the rest of the html page the same? I am trying to do something like AJAX where only part of the html page gets updated and the rest remains the same.

Edit: After tinkering around I only can find websockets as the best option. Actually I found a way to use AJAX to do what I wanted.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.