diff --git a/~dev_rating/media/js/discipline/general.js b/~dev_rating/media/js/discipline/general.js index 589444dc989be15408e0265b09859023640a656b..aa0f23e350c9bc0142f91945db77e3ba8048700f 100644 --- a/~dev_rating/media/js/discipline/general.js +++ b/~dev_rating/media/js/discipline/general.js @@ -15,8 +15,9 @@ $(function() { var optionVal = parseInt($("select.SelectFaculty").children("option:selected").val()); if (optionVal <= 0) return; - - var g_facultyID = optionVal; + + selectSubject.attr("disabled", true); + var g_facultyID = optionVal; $.post( g_URLdir + "handler/map/GetSubjectsList", { @@ -25,15 +26,18 @@ $(function() { function(data) { selectSubject.select2("val", ""); - selectSubject.attr("disabled", true); data = (data !== "") ? $.parseJSON(data) : {}; var jProto = $($.parseHTML("<option></option>")); selectSubject.html(""); - + $.each(data, function (key, cur) { jProto.html(cur.Title).val(cur.ID); selectSubject.append(jProto.clone()); - }); + }); + } + ).always( + function(success) + { selectSubject.removeAttr("disabled"); } );