rosehill/html/js/functions.js

41 lines
1.2 KiB
JavaScript

/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
var COB = {};
COB.populateSections = function(cemetery_id,select_id,BASE_URL) {
var url = BASE_URL + '/cemeteries/viewCemetery.php?format=json;cemetery_id=' + cemetery_id;
YAHOO.util.Connect.asyncRequest('GET',url,{
success : function (o) {
var select = document.getElementById(select_id);
select.innerHTML = '';
select.appendChild(document.createElement('option'));
var sections = YAHOO.lang.JSON.parse(o.responseText).sections
for (i in sections) {
var option = document.createElement('option');
option.setAttribute('value',sections[i].id);
option.appendChild(document.createTextNode(sections[i].code));
select.appendChild(option);
}
},
failure : function (o) {
}
});
}
/* A handy function for doing pop-up confirmations when deleting something */
COB.deleteConfirmation = function (url) {
if (confirm("Are you really sure you want to delete this?\n\nOnce deleted it will be gone forever.")) {
document.location.href = url;
return true;
}
else {
return false;
}
};