]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
Proper treatment of empty response string
authorManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Mon, 16 Feb 2015 14:55:25 +0000 (15:55 +0100)
committerManuel Penschuck <manuel.penschuck@stud.uni-frankfurt.de>
Mon, 16 Feb 2015 14:55:25 +0000 (15:55 +0100)
web/htdocs/scripts/cts.js

index 3f000a86c8af581aab628274510fb3044e99deff..5bb59aab2bbbf573f470d49ea414952306a84293 100644 (file)
@@ -128,8 +128,9 @@ var CTS = new Class({
    writeRegisters: function(values) {
       var arrValues = [];
       Object.each(values, function(v,r) {arrValues.push(r); arrValues.push(v)});
+      var myUrl = '/cts/cts.pl?write,' + encodeURIComponent( arrValues.join(',') );
       (new Request.JSON({
-         url: '/cts/cts.pl?write,' + arrValues.join(','),
+         url: myUrl,
          onSuccess: function(json, text) {
             if (!json) {
                var m = text.match(/<pre>(.*)<\/pre>/i);
@@ -806,11 +807,11 @@ function timestamp2Date(ts) {
    
 
 function requestFailure(obj){
-   console.debug(obj);
+   if (console) console.debug(obj);
+  
    var text = String((typeof(obj) == 'string') ? obj : obj.responseText);
    var m = text.match(/<pre>([\s\S]*)<\/pre>/im);
    
-   
    if (obj.responseText && m) {
       text = m[1];
       m = text.match(/^\s*-+ More[\w\s]+ -+\s+(.+)$/im)