diff --git a/~dev_rating/media/js/errDialog.js b/~dev_rating/media/js/errDialog.js index 1e3f8048010b86d0ad05d23694057f30c3f9031b..f27a9f0b54e4791746d2e7352f912b76c7e7f5a8 100644 --- a/~dev_rating/media/js/errDialog.js +++ b/~dev_rating/media/js/errDialog.js @@ -20,7 +20,7 @@ $(document).ready(function() { { $.getJSON(URLdir + "handler/ErrMessages/getRequests", {}, function(data){ if(typeof(data[0]) == "undefined") - alert("Вы еще ничего не написали"); + EventInspector_ShowMsg('Вы еще ничего не написали', 'error'); else { var valHeight = 0; @@ -52,16 +52,17 @@ $(document).ready(function() { $('.dialogMyMessagesBtn').click(dialogMyMessagesBtn); $('#dialogSendButton').click(function dialogSendButton() { - var thisObj = $(this); - $(this).attr("disabled", true); var mesTitle = $('#messageTitle').val(); var mesText = $('#message').val(); - - if(mesTitle == '') - alert("Вы не ввели сообщение"); - else if(mesText == '') - alert("Вы не ввели тему сообщения"); + if(mesTitle.length == 0) + EventInspector_ShowMsg('Вы не ввели тему сообщения', 'error'); + else if(mesText.length == 0) + EventInspector_ShowMsg('Вы не ввели сообщение', 'error'); else + { + var thisObj = $(this); + $(this).attr("disabled", true); + $.ajax({ type: "POST", url: URLdir + "handler/ErrMessages/createRequest", @@ -79,7 +80,8 @@ $(document).ready(function() { EventInspector_ShowMsg('Сообщение не отправлено', 'error'); thisObj.removeAttr('disabled'); } - }); + }); + } }); });