|
|
@ -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>`)) |
|
|
|