Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/luci.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-11-15 17:40:28 +0300
committerJo-Philipp Wich <jow@openwrt.org>2010-11-15 17:40:28 +0300
commitbb1af307f771d9c4e25cfa5d64ca50502a0f2f40 (patch)
treea246775a819ab8efff594877584d2329a428b608 /themes/base/htdocs/luci-static
parent19d1578077f3364a02e83f561eea0fd95d523f0b (diff)
themes/base: add json decoding to xhr.js
Diffstat (limited to 'themes/base/htdocs/luci-static')
-rw-r--r--themes/base/htdocs/luci-static/resources/xhr.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/themes/base/htdocs/luci-static/resources/xhr.js b/themes/base/htdocs/luci-static/resources/xhr.js
index 7e2e3b090b..9ce302683c 100644
--- a/themes/base/htdocs/luci-static/resources/xhr.js
+++ b/themes/base/htdocs/luci-static/resources/xhr.js
@@ -56,8 +56,18 @@ XHR = function()
xhr.onreadystatechange = function()
{
+ var json = null;
+ if( xhr.getResponseHeader("Content-Type") == "application/json" ) {
+ try {
+ json = eval('(' + xhr.responseText + ')');
+ }
+ catch(e) {
+ json = null;
+ }
+ }
+
if( xhr.readyState == 4 ) {
- callback( xhr );
+ callback( xhr, json );
}
}