Ad

%0A In Text Passed To JavaScript Causes Unterminated String Literal

- 1 answer

When i call:

call('%0D%0ASometext');

I get error:

unterminated string literal

I get the string '%0D%0ASometext' from PHP - it's string entered by user. So is there any way to pass this text to JS function without errors and without removing any info from it?

Ad

Answer

Try this:

call(decodeURIComponent('%0D%0ASometext'));

Ad
source: stackoverflow.com
Ad