Re: is it possible to communicate javascript and php?

From: Date: Fri, 19 Jan 2001 18:20:14 +0000
Subject: Re: is it possible to communicate javascript and php?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35676@lists.php.net to get a copy of this message
> I would like to know if it possible to pass in any way some values > > from javascript functions to php variables ? Yes, but... You can have JavaScript call another URL using something like: document.location = 'http://yoursite.com/whatever.php?foo=' . $foo; But keep this in mind: PHP lives on the server. JavaScript lives in your browser. PHP exists only long enough to deliver your HTML/JavaScript and then "dies". JavaScript runs, long after PHP is gone. To have them talk back and forth requires another page hit for each "exchange" in the conversation. So PHP spewing out some JavaScript is fairly straight-forward -- It's just some more text to generate as far as PHP is concerned. JavaScript talking back to PHP, however, requires a whole 'nother URL to be loaded, and that's expensive. By Day: |By Night: Don't miss the Zend Web Store's | There's not enough room here... Grand Opening on January 23, 2001! | Start here: http://www.zend.com | http://l-i-e.com/artists.htm

« previous php.general (#35676) next »