mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-20 11:29:24 -04:00
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.
21 lines
595 B
JavaScript
21 lines
595 B
JavaScript
$("document").ready(function() {
|
|
ajaxify_comment_form();
|
|
});
|
|
|
|
function ajaxify_comment_form() {
|
|
$("#gComments form").ajaxForm({
|
|
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();
|
|
}
|
|
});
|
|
};
|