summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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 7e2e3b090..9ce302683 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 );
}
}