# HG changeset patch # User Matti Hamalainen # Date 1382433966 -10800 # Node ID 87d3ce535834308c3e6fb3cc55b3aa13ec2e9738 # Parent b5981168ed851e2d7b14a08356150798a10cf39e Comments. diff -r b5981168ed85 -r 87d3ce535834 ajax.js --- 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; }