summaryrefslogtreecommitdiffhomepage
path: root/themes/base/htdocs/luci-static
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-11-18 07:21:14 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-11-18 07:21:14 +0000
commitf3218c456a853e8ec53715525ee97a279083493b (patch)
treebbbdf14dadb0dd3be9a41313c017e1025aeb3fd0 /themes/base/htdocs/luci-static
parentdfc723af3ec8a47871fa27b9b9fb837895453777 (diff)
themes/base: several IE related fixes in XHR class
Diffstat (limited to 'themes/base/htdocs/luci-static')
-rw-r--r--themes/base/htdocs/luci-static/resources/xhr.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/themes/base/htdocs/luci-static/resources/xhr.js b/themes/base/htdocs/luci-static/resources/xhr.js
index 9ce302683..3a30e0468 100644
--- a/themes/base/htdocs/luci-static/resources/xhr.js
+++ b/themes/base/htdocs/luci-static/resources/xhr.js
@@ -56,17 +56,17 @@ 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 ) {
+ 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, json );
}
}
@@ -144,6 +144,9 @@ XHR = function()
this._encode = function(obj)
{
+ obj = obj ? obj : { };
+ obj['_'] = Math.random();
+
if( typeof obj == 'object' )
{
var code = '';
@@ -152,6 +155,7 @@ XHR = function()
for( var k in obj )
code += ( code ? '&' : '' ) +
k + '=' + encodeURIComponent( obj[k] );
+
return code;
}