I'm using JSON format to send some data between two pages. In the second page I need to get the JSON i have encoded in the URL to add some data in it and send it again to a 3rd page. this is the code I used to send the JSON using GET to the second page.
form.submit( function(e) {
// stop the regular form submission
e.preventDefault();
// collect the form data
var data = {};
data["valueDimensional"] = $('#valueDimensional').val();
data["timeSlot"] = $('#timeSlot option:selected').val();
data["splitOption"] = $('#splitOption option:selected').val()
var strJSON = JSON.stringify(data);
var escapedStrJSON = encodeURIComponent(strJSON);
var url = "/warning/app/data?par="+escapedStrJSON;
window.location.href = url;
});
In the second page i tried this:
form.submit( function(e) {
// stop the regular form submission
e.preventDefault();
$.getJSON(window.location.href, function(data) {
//data is the JSON string
alert(data);
});
});