Reputation: 500
I am using this javascript
code for a redirection:
window.location.href = '/zona-privada?message='+data;
I am working with php
as a backend, after the redirect, my php
it is not getting the message parameter. But if I reload the page after it has been redirected it works fine.
Should I do the redirect in a different way? Or what I am doing wrong?
This redirection I am doing it in the javascript
of an ajax
request.
Thank you very much
Ajax code:
$.post(
"/url"
).done(
function(data){
window.location.href = '/home?message='+data;
}
);
my php (using Zend1)
if($this->_params['message']) {
//code goes here
}
Upvotes: 0
Views: 234
Reputation: 256
The problem is with the value of your variable .Try encodeURIComponent(data) before appending it to the window.location.href
Upvotes: 1