Hello, I am trying to input text into a textarea and then send the data through a query string to another webpage. My goal is to display the data on the second webpage. I have written the following code, but it doesn't seem to be working. I've checked the console and the data is reaching webpage2, but it's not being displayed on the HTML page. Can someone please help me figure out what I'm doing wrong?
// Code to redirect to webpage 2 and send data in querystring after encoding
location.href = "https://one.dummyjs.open.html?concern=" + encodeURIComponent($("#concern").val());
// Code to display data on webpage2
var queryString = new Array();
$(function () {
if (queryString.length == 0) {
if (window.location.search.split('?').length > 1) {
var params = window.location.search.split('?')[1].split('&');
for (var i = 0; i < params.length; i++) {
var key = params[i].split('=')[0];
var value = decodeURIComponent(params[i].split('=')[1]);
queryString[key] = value;
}
}
}
if (queryString["concern"] != null ) {
var data = queryString["concern"];
$("textarea#u_issue_description").val(data);
}
});
$(p).html(data)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class= "main-container">
<p></p>
</div>