Page 1 of 1
Redirect page using PHP + jQuery
Posted: Thu Sep 09, 2010 8:36 am
by Bbob
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.
Re: Redirect page using PHP + jQuery
Posted: Thu Sep 09, 2010 1:07 pm
by Eran
Re: Redirect page using PHP + jQuery
Posted: Thu Sep 09, 2010 2:55 pm
by JakeJ
Or just use the jquery load() function.
Re: Redirect page using PHP + jQuery
Posted: Thu Sep 09, 2010 3:18 pm
by Eran
JakeJ wrote:Or just use the jquery load() function.
What does that have to do with redirection?
Re: Redirect page using PHP + jQuery
Posted: Thu Sep 09, 2010 3:21 pm
by JakeJ
Because you can use it to load another page. It's an ajax request.
Re: Redirect page using PHP + jQuery
Posted: Thu Sep 09, 2010 3:25 pm
by Eran
You can use it to load new HTML in the current page, not to redirect to another page.
Re: Redirect page using PHP + jQuery
Posted: Thu Sep 09, 2010 3:43 pm
by JakeJ
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?
Re: Redirect page using PHP + jQuery
Posted: Thu Sep 09, 2010 4:10 pm
by Eran
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