var JSONonj = {"name": "James","age":"25"};
var data = "This data i would like to retrieve and print in the main.html page after success call in ajax.";
$.ajax({
url: "/user",
type: "POST",
data: JSONobj,
dataType: "json",
success: function() {
window.location.href = "main.html";
},
contentType: "application/json"
});
Here is the deal. After success i want to redirect to main.html and when I get there, I would like to retrieve and print data variable there.
The redirection works fine. But I can not receive the data there.