diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-25 00:47:40 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-25 00:47:40 +0000 |
commit | 0bb82b76216d033742afab91ce9e9a20dd607ad8 (patch) | |
tree | 7e662d7a71040d5fa770798449bf27fc93d0994c /modules/comment/js | |
parent | 7a82beb752d51e2d0a1c16446a5e27738192aaf3 (diff) |
Gut the comment module and simplify it. Stop trying to support Atom
and XML for now, we have no driver for those technologies so anything
we implement is not going to be sufficiently tested and therefore
it'll be broken.
Change all comment functions to return JSON and update the JS to deal
purely with JSON. This is our new protocol for talking to the browser
and it should be flexible and portable.
Create comments.html.php. This duplicates comment.html.php, but will
be more efficient for rendering comments since we won't be creating a
new View for every comment we render.
Diffstat (limited to 'modules/comment/js')
-rw-r--r-- | modules/comment/js/comment.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/comment/js/comment.js b/modules/comment/js/comment.js index 259b4826..d251ac96 100644 --- a/modules/comment/js/comment.js +++ b/modules/comment/js/comment.js @@ -4,16 +4,17 @@ $("document").ready(function() { function ajaxify_comment_form() { $("#gComments form").ajaxForm({ - complete: function(xhr, statusText) { - $("#gComments form").replaceWith(xhr.responseText); - if (xhr.status == 201) { - $.get(xhr.getResponseHeader("Location"), function(data, textStatus) { + dataType: 'json', + success: function(data) { + if (data.result == "success") { + $.get(data.resource, function(data, textStatus) { $("#gComments .gBlockContent ul:first").append("<li>"+data+"</li>"); $("#gComments .gBlockContent ul:first li:last").hide().slideDown(); }); $("#gComments form").clearForm(); } + $("#gComments form").replaceWith(data.form); ajaxify_comment_form(); } }); -} +}; |