From efa381257aea9e21856890769f73cab34359576e Mon Sep 17 00:00:00 2001 From: VladimirCherkasov <vcherckasov@yandex.ru> Date: Mon, 6 Jul 2015 16:19:01 +0300 Subject: [PATCH] supportDialog.js improve --- media/js/supportDialog.js | 41 ++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/media/js/supportDialog.js b/media/js/supportDialog.js index ff71d1e6d..43709a2bf 100644 --- a/media/js/supportDialog.js +++ b/media/js/supportDialog.js @@ -1,23 +1,31 @@ $(function () { - var isInit = false; + $('#errButton').click(function () { - $.get(URLdir + "window/support", function (data) { - wnd.open(JSON.parse(data)); - if (!isInit) { - $('#imageFile').change(function () { - document.forms["loadPicture"].submit(); - // now result in #hiddenframe :-/ - $("#hiddenframe").load(function () { - var ret = this.contentWindow.document.body.innerHTML; - // console.log(ret); - }); - }); - isInit = true; - } - }); + $.get(URLdir + "window/support", initErrorDialog); }); var errReady = true; + var requestID = -1; + + function initErrorDialog(data) { + wnd.open(JSON.parse(data)); + if (this.isInit) { + return; + } + $("#hiddenframe").load(function () { + var data = this.contentWindow.document.body.innerHTML; + console.log(data); + if (data.success === true) { + requestID = data.requestID; + } + }); + $('#imageFile').change(function () { + document.forms["loadPicture"].submit(); + // now result in #hiddenframe :-/ + }); + this.isInit = true; + } + initErrorDialog.isInit = false; $(document) .on('click', '#dialogSendButton', function () { @@ -49,7 +57,8 @@ $(function () { url: URLdir + "handler/ErrMessages/createRequest", data: { title: mesTitle, - text: mesText + text: mesText, + requestID: requestID }, success: function (data) { errReady = true; -- GitLab