projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
19d1578
)
themes/base: add json decoding to xhr.js
author
Jo-Philipp Wich
<jow@openwrt.org>
Mon, 15 Nov 2010 14:40:28 +0000
(14:40 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Mon, 15 Nov 2010 14:40:28 +0000
(14:40 +0000)
themes/base/htdocs/luci-static/resources/xhr.js
patch
|
blob
|
history
diff --git
a/themes/base/htdocs/luci-static/resources/xhr.js
b/themes/base/htdocs/luci-static/resources/xhr.js
index 7e2e3b090b67ec4adf73d1de96e6b9b5fdb52450..9ce302683c466f26dda8610e5e043b9503f72f0c 100644
(file)
--- 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
);
}
}