comments working; with some stuff in the theme

pull/10/head
Stephen Searles 7 years ago
parent 432affea76
commit 28c081ed30
  1. 11
      comments/comments.go

@ -128,14 +128,7 @@ func (cs *Service) WriteHTML(post string, w io.Writer) (int64, error) {
<text>{{.Text}}</text> <text>{{.Text}}</text>
</comment> </comment>
{{end}}{{end}} {{end}}{{end}}
<form onsubmit="javascript:submitComment(event)"> <form onsubmit="submitComment(event)">
<script>
function submitComment(evt) {
var xhr = new XMLHttpRequest();
xhr.open('POST', document.location.pathname, true);
xhr.send(JSON.stringify({"text": evt.target.querySelector('textarea').value}));
}
</script>
<p> <p>
<div> <div>
<label for="comment">post a comment:</label> <label for="comment">post a comment:</label>
@ -144,7 +137,7 @@ func (cs *Service) WriteHTML(post string, w io.Writer) (int64, error) {
<textarea placeholder="comment..." name="comment"></textarea> <textarea placeholder="comment..." name="comment"></textarea>
</div> </div>
<div> <div>
<button>post</button> <button type="submit">post</button>
</div> </div>
</p> </p>
</form>`)) </form>`))

Loading…
Cancel
Save