AJAX / PHP header("Location: http://new-url.php");

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Designer
Forum Newbie
Posts: 12
Joined: Fri Nov 19, 2010 5:57 am

Re: AJAX / PHP header("Location: http://new-url.php");

Post by Designer »

I think the solution to this is a bit more involved than meets the eye!

It is one of those jobs you think is only going to take about an hour and so far I have spent two days on it! :oops:

I think the code I have posted to date is flawed is several areas and is not a clean as I would like it to be. Sometimes it is best just to go back to the drawing board.

I noticed there is a forum for people whom like a challenge, so I could also try there.

Using JQuery might simplify the task, but again I'm not an expert at this.

When I find or am told the solution I'll let you all know!
Neilos
Forum Contributor
Posts: 179
Joined: Fri Nov 19, 2010 2:07 am

Re: AJAX / PHP header("Location: http://new-url.php");

Post by Neilos »

We're never experts in the beginning. Or in my case, the middle and the end too.

What is it you're trying to achieve anyway?
Designer
Forum Newbie
Posts: 12
Joined: Fri Nov 19, 2010 5:57 am

Re: AJAX / PHP header("Location: http://new-url.php");

Post by Designer »

What I'm trying to achieve is quite simple at face value.

Use Ajax to validate a form and once valid, pass control to the next screen. It is the passing control that is causing the problem. :banghead:
Designer
Forum Newbie
Posts: 12
Joined: Fri Nov 19, 2010 5:57 am

Re: AJAX / PHP header("Location: http://new-url.php");

Post by Designer »

There's some good news & bad news so far.

The good news, if you can call it that, the route of 'header (Location: 'new-url'); is not possible when using AJAX.

However, there is a way round this problem, but the redirect need to be done using javascript window.location='new.url'; and this redirect is done upon successful completion of Ajax validation, both client and server-side.

All I need to do now is get the Ajax code working!

Any experts on Ajax? :?:
Post Reply