access values from redirected page
agitaev opened this issue · 1 comments
agitaev commented
I am sending AJAX POST request from the page and redirecting to another page on the same domain.
$.ajax({
type: form.method,
url: form.action,
data: $(form).serialize(),
dataType: 'json',
success: function(response) {
// redirect with response
$.redirect({
url: <my_url_here>,
values: { payload: response },
target: '_blank'
})
}
})
How can I access payload
from the redirected page?
mgalante commented
First of all, frontend cannot access the posted data. So the only way to do it is, having a server part creating a <script> with the data dinamically.
If the data isnt too long you can use GET instead of POST, and read it from the window.location variable. (but will be exposed to the user in the URL)
If you want to read the data just from the frontend, i suggest to use sessionStorage in order to temporarly store the data.