You are here: Re: Variables accessible by Javascript and PHP « PHP Language « IT news, forums, messages
Re: Variables accessible by Javascript and PHP

Posted by Jam Pa on 05/26/05 12:20

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.
>>

 

Navigation:

[Reply to this 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

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