title: Passing JSON in URL from Javascript
body: <p>I have a data extracted from a <code>textarea</code> which is something like this:</p>
  
  <pre>TO WHOM IT MAY CONCERN:
                              This is to certify that Mr/Ms JOHN SMITH is enrolled in this institution for this First Semester of School Year 2013-2014
                              as a second year Psychology student. Below is his/her STATEMENT OF ACCOUNT.</pre>
  
  <h3>What I've tried?</h3>
  
  <pre><code>var letter = $('#textarea_letter').val();
  var myJSON = {"letter": letter }; 
  var strJSON = JSON.stringify(myJSON); 
  
  $('#toPDF_button').attr('href', 'generate_pdf/'+ myJSON +'/pdf'); 
  // this button then sends the letter to a function w/c generates the PDF
  </code></pre>
  
  <h3>What did I get?</h3>
  
  <p><strong>An Error_404 page</strong></p>
  
  <p>I need to pass the letter in the param url, this is how it looks like in the url:</p>
  
  <pre><code>localhost/accounting/generate_pdf/{"letter":"TO WHOM IT MAY CONCERN:\n\t\t\t\t\t\t\tThis is to certify that Mr/Ms JOHN S&gt; SMITH is enrolled in this institution for this First Semester of School Year 2013-2014\n\t\t\t\t\t\t\tas a second year BSIT student. Below is his/her STATEMENT OF ACCOUNT."}/pdf
  </code></pre>
  
  <p>How can I be able to do this? I'm new to JSON. Thanks</p>
  
  <h3>UPDATE</h3>
  
  <p>After doing this <code>var myJSON = encodeURIComponent(JSON.stringify(myJSON1));</code><br>
  here is the new URL but still gets the same error</p>
  
  <pre><code>http://localhost/accounting/accounting/generate_sta/%7B%22letter%22%3A%22TO%20WHOM%20IT%20MAY%20CONCERN%3A%5Cn%5Ct%5Ct%5Ct%5Ct%5Ct%5Ct%5CtThis%20is%20to%20certify%20that%20Mr%2FMs%20JOHN%20SMITH%20G.%20SEBUCAO%20is%20enrolled%20in%20this%20institution%20for%20this%20First%20Semester%20of%20School%20Year%202013-2014%5Cn%5Ct%5Ct%5Ct%5Ct%5Ct%5Ct%5Ctas%20a%20second%20year%20Psychology%20student.%20Below%20is%20his%2Fher%20STATEMENT%20OF%20ACCOUNT.%22%7D/pdf
  </code></pre>