I am developing web application.
I am sending json string from one page to another.
I have used jquery to send the post data.
In the target page I want to retrieve the same data.
But I am getting the null value there.
my page which posts json string to page is:
$(document).ready(function () {
$.post("./ProfileUser.jsp",{jsonData:jsonstr});
$(location).attr('href',"./ProfileUser.jsp");
});
And in the page ProfileUser.jsp
<%
String jsonData = request.getParameter("jsonData");
String mobile;
if(jsonData == null) mobile = "something went wrong";
else {
JSONObject j =new JSONObject(jsonData);
mobile = j.getString("mobile");
}
%>
I am getting output as Something went wrong which should be mobile number from the database.
How should I get the json data in jsp?
Thank you