From 653fd8b3f70c3ac8e0d92ef53e463daa0e3297d8 Mon Sep 17 00:00:00 2001 From: khawkins98 <khawkins98@gmail.com> Date: Mon, 26 Mar 2018 15:26:21 +0100 Subject: [PATCH] Don't use a synchronous request #127 --- .../script/4_ebiFrameworkContent.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/js/ebi-global-includes/script/4_ebiFrameworkContent.js b/js/ebi-global-includes/script/4_ebiFrameworkContent.js index fb6cdeb2..c12a6b05 100644 --- a/js/ebi-global-includes/script/4_ebiFrameworkContent.js +++ b/js/ebi-global-includes/script/4_ebiFrameworkContent.js @@ -422,14 +422,21 @@ function ebiFrameworkIncludeAnnouncements() { if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } - xmlhttp.onreadystatechange=function() { - if (xmlhttp.readyState==4 && xmlhttp.status==200) { - eval(xmlhttp.responseText); - detectAnnouncements(m); + xmlhttp.open("GET", file, true); + xmlhttp.onload = function (e) { + if (xmlhttp.readyState === 4) { + if (xmlhttp.status === 200) { + eval(xmlhttp.responseText); + detectAnnouncements(m); + } else { + console.error(xmlhttp.statusText); + } } - } - xmlhttp.open("GET", file, false); - xmlhttp.send(); + }; + xmlhttp.onerror = function (e) { + console.error(xmlhttp.statusText); + }; + xmlhttp.send(null); } if (window.location.hostname.indexOf('wwwdev.') === 0) { -- GitLab