Rename method.
[Sone.git] / src / main / resources / static / javascript / sone.js
index 01c04a1..75fa965 100644 (file)
@@ -407,3 +407,22 @@ function getReply(replyId, callbackFunction) {
                }
        });
 }
+
+/**
+ * Ajaxifies the given notification by replacing the form with AJAX.
+ *
+ * @param notification
+ *            jQuery object representing the notification.
+ */
+function ajaxifyNotification(notification) {
+       notification.find("form.dismiss").submit(function() {
+               return false;
+       });
+       notification.find("form.dismiss button").click(function() {
+               $.getJSON("ajax/dismissNotification.ajax", { "formPassword" : getFormPassword(), "notification" : notification.attr("id") }, function(data, textStatus) {
+                       if (data.success) {
+                               notification.slideUp();
+                       }
+               });
+       });
+}