From: Jo-Philipp Wich Date: Sat, 28 Apr 2018 20:55:08 +0000 (+0200) Subject: luci-base: xhr.js: fix timeout setting with IE 11 X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=34821b15a5bf98ad951329d07b5ed3fe65623f8d;ds=sidebyside luci-base: xhr.js: fix timeout setting with IE 11 Internet Explorer 11 requires the timeout to be applied after the open() call, otherwise an invlaid state exception will be raised Fixes aa6c97154 ("luci-base: extend xhr.js") Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/xhr.js b/modules/luci-base/htdocs/luci-static/resources/xhr.js index 91dcf3fef..de4476cdd 100644 --- a/modules/luci-base/htdocs/luci-static/resources/xhr.js +++ b/modules/luci-base/htdocs/luci-static/resources/xhr.js @@ -54,11 +54,11 @@ XHR = function() else url += '?' + code; + xhr.open('GET', url, true); + if (!isNaN(timeout)) xhr.timeout = timeout; - xhr.open('GET', url, true); - xhr.onreadystatechange = function() { if (xhr.readyState == 4) { @@ -92,10 +92,11 @@ XHR = function() callback(xhr); } + xhr.open('POST', url, true); + if (!isNaN(timeout)) xhr.timeout = timeout; - xhr.open('POST', url, true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.send(code); }