aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/static/js/comment_show.js
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/static/js/comment_show.js')
-rw-r--r--mediagoblin/static/js/comment_show.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/mediagoblin/static/js/comment_show.js b/mediagoblin/static/js/comment_show.js
index 35183beb..42a21817 100644
--- a/mediagoblin/static/js/comment_show.js
+++ b/mediagoblin/static/js/comment_show.js
@@ -18,21 +18,22 @@
var content="";
function previewComment(){
- if ($('#comment_content').val() && (content != $('#comment_content').val())) {
- content = $('#comment_content').val();
- $.getJSON($('#previewURL').val(),JSON.stringify($('#comment_content').val()),
- function(data){
- $('#comment_preview').replaceWith("<div id=comment_preview><h3>{% trans -%}Comment Preview{%- endtrans %}</h3><br />" + decodeURIComponent(data) +
- "<hr style='border: 1px solid #333;' /></div>");
- });
- }
+ if ($('#comment_content').val() && (content != $('#comment_content').val())) {
+ content = $('#comment_content').val();
+ $.post($('#previewURL').val(),$('#form_comment').serialize(),
+ function(data){
+ preview = JSON.parse(data)
+ $('#comment_preview').replaceWith("<div id=comment_preview><h3>" + $('#previewText').val() +"</h3><br />" + preview.content +
+ "<hr style='border: 1px solid #333;' /></div>");
+ });
+ }
}
$(document).ready(function(){
$('#form_comment').hide();
$('#button_addcomment').click(function(){
$(this).fadeOut('fast');
$('#form_comment').slideDown(function(){
- setInterval("previewComment()",500);
+ setInterval("previewComment()",500);
$('#comment_content').focus();
});
});