Re: AJAX and PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



in fact i meant by redirecting the following thing :
- if user wrote a correct pwd and login, the system should redirect [using
header("Location .... ] syntax to launch the application.
but if i use such syntax it will be redirected only into the div#0, and not
in the browser itslef.

is it clearer now ?

On Mon, Apr 21, 2008 at 11:40 AM, Thijs Lensselink <dev@xxxxxxxx> wrote:

> Quoting Alain Roger <raf.news@xxxxxxxxx>:
>
>  you understood right.
> >
> > basically my problem is that the layout avoid it.
> > here is "something like" my layout :
> >
> > <div#0>
> > <div#1>Lanague (label) : <img flag> <img arrow to show all languages
> > from
> > div#2></div#1>
> > <div#2> all flags</div#2>
> > <div#3> login field  + pwd field + submit button</div#3>
> > </div#0>
> >
> > till now i only use AJAX to refresh the content of div#3
> > but it does not change the label from div#1 when user selects another
> > language from div#2.
> >
> >
> Well it looks like you need a extra Ajax call to the server.
>
> Click a language flag sends a request to the server. The server responds
> with an JSON object. Containing the content for <div#2>. With javascript you
> can update the contents of <div#2>
>
>  if i place the whole form into a PHP i face several questions :
> > - how the ajax will reload this PHP page  (reloading itself) in the
> > parent
> > control div#0 ?
> >
>
> If you would like to reload the whole of <div#0> You could send and JSON
> object from PHP to javascript. And let javascript generate the div structure
> and update the DOM.
>
>  - when user will click on submit button, where will be loaded the content
> > return of checking if log+pwd are correct ?
> >
>
> When a user logs in a Ajax request is send to the server. the server
> responds with an JSON object containing the error message. With javascript
> you could update the contents of <div#3> to display a message.
>
>  - how to redirect to another PHP page, when user click on submit button ?
> > the redirection will happen only in the content div, so only in div#0
> > and
> > not into the browser :-(
> >
>
> I have a hard time understanding this last issue. What exactly do you mean
> by redirecting to another PHP page?
>
>
>
> > Al.
> >
> > On Mon, Apr 21, 2008 at 9:55 AM, Thijs Lensselink <dev@xxxxxxxx> wrote:
> >
> >  Quoting Alain Roger <raf.news@xxxxxxxxx>:
> > >
> > >  Hi,
> > > >
> > > > i'm playing around with AJAX and PHP to create something like a
> > > "small
> > > > desktop" application.
> > > > basically the first step is to log in the system.
> > > > for that i have a log-in form where users can choose the interface
> > > > language.
> > > >
> > > > here is my problem :
> > > > when the log-in form runs, it is in English. user can click on some
> > > > arrow to
> > > > open another DIV and display all other languages available.
> > > > a click on a particular flag, will call the PHP page where the
> > > log-in
> > > > form
> > > > (login field + password field) are stored with dynamic language
> > > > interface.
> > > >
> > > > however, i make no sense for the title of this form to call a PHP
> > > page
> > > > where
> > > > will be just 1 dynamic text (changing on flag choice).
> > > > so if you understand well, i have 2 divs (1 for form title, 1 for
> > > log-in
> > > > form itself). and i load thanks AJAX php code into divs.
> > > >
> > > > my problem is that i do not want to write a PHP page just for 1
> > > label...
> > > > it
> > > > makes sense for a complete form but not for a simple text line or
> > > label.
> > > >
> > > > So how can i do that without refreshing page. using AJAX and PHP
> > > only ?
> > > > i guess you already faced such situation so i would really
> > > appreciate
> > > > your
> > > > help.
> > > >
> > > > thanks a lot,
> > > >
> > > > --
> > > > Alain
> > > >
> > >
> > > Making an Ajax request for one little label maybe a bit overkill.
> > > As i understand you request the whole form through an Ajax request.
> > > And
> > > display this to the user? And every language generates a new form?
> > >
> > > Why not just create the form dynamically with javascript and load the
> > > data
> > > from PHP. So the form can stay the same for all calls. You just fill
> > > it with
> > > data depending on the language selected. You can fill the form for
> > > instance
> > > by sending a JSON encoded object from PHP to javascript.
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> >
> > --
> > Alain
> > ------------------------------------
> > Windows XP SP2
> > PostgreSQL 8.2.4 / MS SQL server 2005
> > Apache 2.2.4
> > PHP 5.2.4
> > C# 2005-2008
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux