[nycphp-talk] Javascript trigger
Lars Gelfan
ldgphp at ldgmedia.com
Fri Mar 24 07:17:27 EST 2006
It really depends on the complexity and size of the dataset - if you can
pre-fetch the entire range of options then you could store the values in
javascript arrays and/or a XML object, in either case using PHP as the
conduit to the database and to create the XML or javascript data.
If you really need to do a database query for each menu level, you'll need
to use javascript to get the data via a XMLHTTP request or similar method
and again use PHP to do the database call and data formatting on the fly.
And while you can use javascript to do all this without reloading the page,
you will almost certainly have latency issues trying to keep up with
mouseover interactions -- if that is how you intend the menu to work. The
more you can do asynchronously, the better (at least in terms of user
experience).
-lars
On 3/24/06 5:25 AM, "Alberto dos Santos" <yournway at gmail.com> wrote:
> Hi,
> I need an example of javascript triggering an MySQL query through PHP.
> What for?
> It will be a cascading javascript menu where option 2 is retrieved from the
> database according to the first selection and so on.
> In all it will be a 4 level menu.
> Any pointers/hints/examples would come in handy.
>
> TIA
--
L A R S G E L F A N
.....................
lars at ldgmedia.com
More information about the talk
mailing list