<!DOCTYPE html> <html> {{ template "head.html" }} <body> <header> <nav> <a href="/index.html">HOME</a> <a href="/add_recipes">add recipe</a> </nav> <h1>{{.Title}}</h1> </header> <main> <pre contenteditable="true" id="editor">{{.Text}}</pre> <button onclick="save()">save</button> <a href="/recipe?id={{.Id}}"><button>back</button></a> {{ template "footer.html" }} </main> <script> function save() { const xhttp = new XMLHttpRequest(); xhttp.open("POST", "/recipe/edit?id={{.Id}}", true); xhttp.send(document.getElementById('editor').innerText); } </script> </body> </html>