I have an Ajax call that returns some json data when it is successful.
This data needs to be displayed on another page that user will be redirected to.
window.location.replace('http://example.com/newpage');
And on this page the data should be displayed.
Apart from sessions/cookies is there any other way to carry this data? Or is sessions the normal way this is done?
Use localstorage the api. It works in the following manner:
Set an item:
localStorage.setItem('myCat', 'Tom');
Retrieve an item:
localStorage.getItem('myCat');
localstorage offers string data to be stored accross multiple browser sessions. If you want to store object and/or arrays you have to serialize/deserialize them using:
json.stringify()json.parse()If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With