Comments: fixes #9 #10

Merged
stephen merged 6 commits from comments into master 2017-09-06 14:14:32 +00:00
Showing only changes of commit 28c081ed30 - Show all commits
+2 -9
View File
@@ -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>`))