luci-base: xhr.js: fix timeout setting with IE 11
[project/luci.git] / modules / luci-base / htdocs / luci-static / resources / xhr.js
index 91dcf3f..de4476c 100644 (file)
@@ -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);
        }