Posted by Paul on 05/26/05 21:17
Jam Pa wrote:
> There is a simple, well known way to transmit data between javascript on a
> page and the server. No page submits or loads, just call a js function.
>
> Enter XMLHTTPREQUEST and AJAX!
>
> http://en.wikipedia.org/wiki/AJAX&e=10313
> http://developer.apple.com/internet/webcontent/xmlhttpreq.html
>
> Paul <freelance@dezignage.net> wrote in
> news:uALke.1471779$6l.530601@pd7tw2no:
>
>
>>"Passing" variables from PHP to JavaScript is much easier than the
>>other way around.
>>
>>ie: echo "<script type='text/javascript'>thisPage =
>>'{$_SERVER['PHP_SELF']}';</script>";
>>
>>(very basic example).. but as soon as you're trying to pass variables
>>from JavaScript to PHP it gets quite a bit more complicated. As far as
>>I know, you will not be able to do it in any other way other than
>>submitting the page with a form (hidden fields and what not) .. or
>>through the URL .. (which can reveal data).
>>Paul
>>
>>Tom Scales wrote:
>>
>>>I need a set of variables that I can access in both PHP and in
>>>Javascript. There are just a few things I can do in one that I cannot
>>>do in the other.
>>>
Hi! Yeah I know about this method too. The reason I decided not to
mention it... or even use it in my projects yet... is simply because it
is fairly immature still... and more complicated than the iframe way.
Iframe's have been supported for quite a while now... so their
functionality is quite predictable in most cases. I designed an RPC web
app that had the ability to retreive practically any data required
without reloading the page... including submitting a form via POST
without any problems... I have only tested it under IE and Gecko baseb
browsers though...
[Back to original message]
|