خرید بک لینک

Vote count: 0

Hello i have an array passed it through the url to another html page but when i attempt to decode it's no longer an array.

var a = ["Boy", "Girl"];

var b = [];
var conv_a = JSON.stringify(a);
b.push(encodeURIComponent('myArray')+'='+encodeURIComponent(conv_a));
'nextpage.html?'+b.join('&');

Now when decoding:

var results ={};
      var c = location.search.replace('?', '').split('&');
     for(var i=0, l=fs.length;i<l;i++) {
          var z = c[i].split('=');
          results[decodeURIComponent(z[0])] = decodeURIComponent(z[1]);
        }

 console.log(results.myArray);

it printouts:

Object {three: "%255B%2522Boy%2522%252C%2522Girl%2522%255D"}

But i intend to print out the actual array. Please what did i get wrong

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 16 اسفند 1394 ساعت: 14:50

صفحه بندی