What is the best way to decode the following URL to use with JavaScript?
URL:
https://www.example.com/post.php?v=1&text=it's-me&20hello%0Aworld%0A
Currently if a '
is present in the URL, it's causing an error and newlines (blank lines) are also not interpreted.
Code:
<?php
$postText = $_GET["text"];
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<script type="text/javascript">
var options = {
prefilltext: '<?php echo $postText;?>',
};
</script>
</body>
</html>