diff options
author | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-01-18 17:32:23 +0000 |
---|---|---|
committer | Sascha Volkenandt <sascha (at) akv-soft (dot) de> | 2007-01-18 17:32:23 +0000 |
commit | 50472f76582d0ac83960dc735372a1cf99fda7b0 (patch) | |
tree | 35a337e5db129461ac15bbe4d363675e9f4dff15 /javascript | |
parent | 070d81369b1e3f499a9f6d5fe112e424ef71b5e3 (diff) | |
download | vdr-plugin-live-50472f76582d0ac83960dc735372a1cf99fda7b0.tar.gz vdr-plugin-live-50472f76582d0ac83960dc735372a1cf99fda7b0.tar.bz2 |
- displaying error message now if an ajax request succeeded but the underlying action failed
Diffstat (limited to 'javascript')
-rw-r--r-- | javascript/ajax.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/javascript/ajax.js b/javascript/ajax.js index ddc6122..089ed3e 100644 --- a/javascript/ajax.js +++ b/javascript/ajax.js @@ -19,7 +19,7 @@ function LiveAjaxCall(url) this.xml = xml; this.onerror = function(message) {}; - this.oncomplete = function(result) {}; + this.oncomplete = function() {}; this.request = function(param, value) { @@ -36,8 +36,14 @@ function LiveAjaxCall(url) if (this.xml.readyState == 4) { if (this.xml.status == 200) { var xmldoc = xml.responseXML; - var result = xmldoc.getElementsByTagName('response').item(0).firstChild.data; - this.oncomplete(result); + var result = Number(xmldoc.getElementsByTagName('response').item(0).firstChild.data); + alert(result); + if (!result) { + var error = xmldoc.getElementsByTagName('error').item(0).firstChild.data; + alert(error); + this.onerror(error); + } else + this.oncomplete(); } else { this.onerror('Invocation of webservice "'+this.url+'" failed with http status code '+this.xml.status); } @@ -52,7 +58,6 @@ function LiveSimpleAjaxRequest(url, param, value) { var xml = new LiveAjaxCall(url); xml.onerror = function(message) { alert(message); } - xml.oncomplete = function(response) { } xml.request(param, value); }; |