title: Javascript array to URL encoded string
body: <p>I'm working on the datalayer of a website and I am required to pass a string filled in with values from the site's backend.</p>
  
  <p>Here is the structure of the variable I need to pass:</p>
  
  <p><strong>> Before encoding:</strong></p>
  
  <blockquote>
    <p>transaction_id=0815/2009;transaction_cid=54AB;item_id=402163045080;item_va
    lue=25.20;item_quantity=1;
    transaction_id=0815/2009;transaction_cid=54AB;item_id=402163045080;item_va
    lue=25.20;item_quantity=1;</p>
  </blockquote>
  
  <p><strong>> After encoding:</strong></p>
  
  <blockquote>
    <p>transaction_id%3D0815%2F2009%3Btransaction_cid%3D54AB%3Bitem_id%3D40216304
    5080%3Bitem_value%3D25.20%3Bitem_quantity%3D1%3Bitem_id%3D847163029054%3Bi
    tem_value%3D16.81%3Bitem_quantity%3D2</p>
  </blockquote>
  
  <p>I have managed to create an array with the necessary data in this form:</p>
  
  <blockquote>
    <p>'[{"transaction_id":"233684","transaction_cid":"d2871c13c507583048d8ecf4a16f94c0","i
                    tem_id":"3524","item_value":"4915.13","item_quantity":"1"}]',</p>
  </blockquote>
  
  <p>But what I need is all these elements of the array in a url encoded string.</p>
  
  <p>I am out of ideas since all that I try seems to not work.</p>
  
  <p>Using JSON.stringify keeps the ":" and the """, using alert() or join also keeps the ":" and is not performant.</p>
  
  <p><strong><em>EDIT:</em></strong></p>
  
  <p><strong>Example array:</strong></p>
  
  <pre><code>arr : {key1: 'a', key2:'b', key3:'c'}
  </code></pre>
  
  <p><strong>non encoded result:</strong></p>
  
  <pre><code>str : 'key1=a;key2=b;key3=c'
  </code></pre>
  
  <p><strong>desired result:</strong></p>
  
  <p>str : 'key1%3Da%3Bkey2%3Db%3Bkey3%3Dc'</p>