Hi
Im using jQuery to get the values from a form and pass to PHP for validation. Once validations are ok, how do I redirect to another page?
Using PHP header(location) doesnt seem to work.
Redirect page using PHP + jQuery
Moderator: General Moderators
Re: Redirect page using PHP + jQuery
Use the DOM location object -
https://developer.mozilla.org/en/document.location
https://developer.mozilla.org/en/document.location
Re: Redirect page using PHP + jQuery
Or just use the jquery load() function.
Re: Redirect page using PHP + jQuery
What does that have to do with redirection?JakeJ wrote:Or just use the jquery load() function.
Re: Redirect page using PHP + jQuery
Because you can use it to load another page. It's an ajax request.
Re: Redirect page using PHP + jQuery
You can use it to load new HTML in the current page, not to redirect to another page.
Re: Redirect page using PHP + jQuery
I understand that, but if someone doesn't know that function exists, it might be a better option. Just because someone says "redirect" doesn't necessarily mean an actual redirect is the best option.
We've all used terms not being aware of other options. If the OP doesn't find it useful, no biggie, but it's an option to explore no?
We've all used terms not being aware of other options. If the OP doesn't find it useful, no biggie, but it's an option to explore no?
Re: Redirect page using PHP + jQuery
You need to be clear then in what you mean, especially if you believe the OP does not know the difference. The way you wrote it seems to be another way to redirect the page. Personally, I believe redirecting after a successful form submission is the correct approach