I have a data extracted from a textarea which is something like this:
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.
What I've tried?
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
What did I get?
An Error_404 page
I need to pass the letter in the param url, this is how it looks like in the url:
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> 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
How can I be able to do this? I'm new to JSON. Thanks
UPDATE
After doing this var myJSON = encodeURIComponent(JSON.stringify(myJSON1));
here is the new URL but still gets the same error
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
index.phpso did you remove it with htaccess. and if yes, then why do you haveaccounting/accounting. what I'm trying to say is: are you sure that this url is well formed? because the last part of your url is considered as a segment which will not produce a 404 error.