|
|
|
@ -128,14 +128,7 @@ func (cs *Service) WriteHTML(post string, w io.Writer) (int64, error) { |
|
|
|
|
<text>{{.Text}}</text> |
|
|
|
|
</comment> |
|
|
|
|
{{end}}{{end}} |
|
|
|
|
<form onsubmit="javascript: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> |
|
|
|
|
<form onsubmit="submitComment(event)"> |
|
|
|
|
<p> |
|
|
|
|
<div> |
|
|
|
|
<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> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<button>post</button> |
|
|
|
|
<button type="submit">post</button> |
|
|
|
|
</div> |
|
|
|
|
</p> |
|
|
|
|
</form>`)) |
|
|
|
|