At 3:51 PM -0700 3/31/08, Susan Shemin wrote:
Just as this question came up here, I was again researching it on the internet, and very clearly saw that the crux of the problem is that Javascript is client side and PHP server side, meaning the 2 don't mix unless in Ajax.

They mix Okay, but don't communicate well without effort.

The reason for this is simple -- just before a web page is delivered to a users browser all of php's work is done and as the web page loads in the browser, then javascript's work starts.

Communication between the two languages is a question of timing.

Ajax is simply javascript sending data (via POST or GET) to a slave php script, which in turn provides data back to the web page without the need for a refresh.

The communication is exactly the same as if you were using a form minus the refresh.

The problem, of course, is that javascript has security issues and some users would rather have a refresh than risk security.

Javascript and php can play well together as this demonstrates:

http://webbytedd.com/b/timed-php/

But, it's not simple.  :-)

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to