Reply to Re: php ajax redirect

Your name:

Reply:


Posted by Rik Wasmus on 11/27/07 17:14

On Tue, 27 Nov 2007 16:01:46 +0100, Mike <ampeloso@gmail.com> wrote:
> On Nov 27, 9:47 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>> On 27 Nov, 14:37, Mike <ampel...@gmail.com> wrote:
>> > I have a Login page that checks a Db for a Un and Pw using ajax.
>> > If the Login is incorrect, they just get a embedded message.
>> > If it is correct, I want to redirect COMPLETLY.
>> > Whats happening is the new page is being embedded into the login pa=
ge,
>> > and I dont want that.
>> > ............................
>> > if ($rowcount=3D=3D0){
>> > echo "<p>Wrong Username or Password Dufus</p>";}
>>
>> > else
>> > {//echo "<p>Your logged in $result_1[U]</p>";
>> > $_SESSION['U'] =3D $result_1[U];
>> > $_SESSION['P'] =3D $result_1[P];
>> > header( 'Location: Main_Mockup.php' );}
>>
>> > ...............................
>>
>> Now for your initial question, it depends on what you are doing on th=
e
>> client with this returned data. Are you in a frame? Maybe you could
>> use the href object?
>
> I dont proofread till the end
> I am not in a frame (yuk).
> I just want to redirect out to a new page and keep my _session
> Variables (Which it does anyway).
> I'm pretty good with php, but new at AJAX.

If you're getting the output with an javascript request, sending redirec=
t =

headers won't help you changing the current page (most HTTP headers are =
=

useless). It can redirect javascript, so in this case the javascript =

request will indeed be redirected to an entire page, and as long as you =
=

have configured javascript to write the output of the request to the =

current document...

Common practise is to return a (JSON) object that holds the 'action to b=
e =

performed', which is interpreted by the javascript asking for a response=
=

to begin with. Wether it is to add content, alter form elements, or do a=
=

location.replace on the window, all is possible as long as javascript =

understands your output. How to do this reliably is better asked in =

comp.lang.javascript.
-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация