changeset 115:87d3ce535834

Comments.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 22 Oct 2013 12:26:06 +0300
parents b5981168ed85
children a95facb41c86
files ajax.js
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ajax.js	Tue Oct 22 12:26:01 2013 +0300
+++ b/ajax.js	Tue Oct 22 12:26:06 2013 +0300
@@ -77,6 +77,11 @@
 }
 
 
+//
+// Function for creating AJAX POST request arguments list based
+// on fields and giving them specified types. Also basic check
+// for validity can be performed (e.g. field empty or not)
+//
 function makePostArgs(fields, fprefix, fsuffix)
 {
   var res = [];
@@ -143,15 +148,19 @@
     setTimeout(func, 50);
   }
 
+  // Clearly mark the element when asking confirmation
   var item = document.getElementById(prefix+id);
   var tmp = item.style.background;
   item.style.background = "red";
 
+  // Ask confirmation for deletion
   if (confirm("Are you sure you want to delete "+dsc+" #"+id+"?"))
   {
+    // Okay, delete
     sendPOSTRequest("action=delete&type="+type+"&id="+id, msuccess);
   }
 
+  // Restore background
   item.style.background = tmp;
 }