$(function() { $('#parent').change(function() { var programID = $(this).val(); setAclList(programID); /* Determine whether the project can change the project set. */ link = createLink('project', 'ajaxCheckProduct', 'programID=' + programID + '&projectID=' + projectID); $.getJSON(link, function(data) { var changed = true; if(data && data.result) { changed = confirm(data.message); if(changed) { /* Select change to the new program products. */ var lastProductSelect = $('#productsBox .input-group:last select:first'); if($(lastProductSelect).val() == 0) { var lastProductSelectID = $(lastProductSelect).attr("id"); var lastProductSelectName = $(lastProductSelect).attr("name"); $('#' + lastProductSelectID + '_chosen').remove(); $(lastProductSelect).replaceWith(data.newProducts); $('#productsBox .input-group:last select:first').attr('name', lastProductSelectName).attr('id', lastProductSelectID).chosen(); } } } if(data && !data.result) { $('#promptTable tbody tr').remove(); for(var i in data.message) { var product = data.message[i]; $('#promptTable').append("
" + project +"
"; } $('#promptTable').append("