diff options
Diffstat (limited to 'modules/tag/js')
-rw-r--r-- | modules/tag/js/tag.js | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/modules/tag/js/tag.js b/modules/tag/js/tag.js index 30e9ca50..fbcbd419 100644 --- a/modules/tag/js/tag.js +++ b/modules/tag/js/tag.js @@ -1,19 +1,17 @@ $("document").ready(function() { - var options = { - target: "#gTagFormContainer", - success: function(responseText, statusText) { - $("#gAddTag").ajaxForm(options); - } - }; - $("#gAddTag").ajaxForm(options); + ajaxify_tag_form(); }); -function get_tag_block(url) { - $.post(url, function(data) { - $('#gTagFormContainer').html(data); - $("#gAddTag").submit(function(event){ - get_tag_block($("#gAddTag").attr("action")); - return false; - }); +function ajaxify_tag_form() { + $("form#gAddTag").ajaxForm({ + complete: function(xhr, statusText) { + $("form#gAddTag").replaceWith(xhr.responseText); + if (xhr.status == 201) { + $.get($("#gTagCloud").attr("src"), function(data, textStatus) { + $("#gTagCloud").html(data); + }); + } + ajaxify_tag_form(); + } }); } |