Browse Source

Added urlencoding 4 defaultparameter

Manuel Gall 2 years ago
parent
commit
4edfc7ec60
1 changed files with 4 additions and 4 deletions
  1. 4 4
      template/js/ui.js

+ 4 - 4
template/js/ui.js

@@ -27,7 +27,7 @@ function makeFrame(lx, ly, rx, ry, content = "", id = "", defaultpara = "", show
   }
   console.log(content);
   if(content != "empty"){
-  console.log("drinn");
+    console.log("drinn");
     
     //add new ellement to storage
     window.storage.push({lx:lx, ly:ly, rx:rx, ry: ry})
@@ -58,18 +58,18 @@ function makeFrame(lx, ly, rx, ry, content = "", id = "", defaultpara = "", show
     container.appendChild(cell);
     //Create new element with width, heigth and content
     //$(".item" + lx + "-" + ly).css({"display": "block", "border-style": "solid", "border-color": "blue", "grid-column": (lx+1) + " / span " + (rx-lx+1),  "grid-row": ly+1 + " / span " + (ry-ly+1)});
-    
     if(content != null && content != ""){
-    
+      
       var fullurl = content;
       //encode default parameter in URL
       if(defaultpara != "{}"){
         var fullurl = fullurl + "?";
         for (var key in defaultpara) {
           if (defaultpara.hasOwnProperty(key)) {
-            fullurl = fullurl + key + "=" +  defaultpara[key] + "&";
+            fullurl = fullurl + key + "=" +  encodeURIComponent(defaultpara[key]) + "&";
            }
         }
+        fullurl = fullurl.slice(0, -1);
       }