Re: php <-> js (was Javascript Navigation)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 5:54 PM -0700 4/27/06, Paul Novitski wrote:
At 04:39 PM 4/27/2006, tedd wrote:
What I don't get is how php can pass variables to js and cause it to run "at will".

Do you mean the way one function can call another function within the same program?

No, I realize that php are two different language on two different computers sharing one event.

It sounds like you're picturing PHP & JavaScript executing continuously & simultaneously. You aren't, are you?

Not simultaneously and/or continuously but an easy way to communicate with each other.

JavaScript can execute a PHP program "at will" simply by requesting a PHP page from the server. PHP can execute a JavaScript function "at will" simply by downloading it (with at least minimal HTML markup) to a browser.

That seems pretty simple & direct to me, considering that they're running in different computers.

What's simple and direct to you may not be to others -- and I fully realize that both environments are running on different computers at different times -- it's the your perspective of "at will" I need to come to terms with.

I can see how php can, and have used php to, generate a web page which has <body onload="js()"> tag, which can pass a variable to js and will cause js to execute. But, isn't there anything else? Is that all there is?
...
I also understand that php can generate html (have done it) and echo out javascript that may, or may not, run if js is present -- like Robert suggested in his WAHOOEY (LOL) example. But, that appears messy to me. If php wants to say something to js, then a page must be created -- it seems like a lot foreplay to get at the goodies.

Without a downloaded page, what goodies are there?

You know, you can download pure JavaScript, dressed only in a script tag, to a browser and have it execute without carrying with it a whole HTML page. Is that what you're looking for? What would such a script accomplish that a PHP program couldn't? I suppose it could interact with the human user with prompts, alerts, and confirms; gather information about the client such as monitor & window size; grab local time to compare to server time. What else? If it has to create DOM nodes to interact with the user, haven't you come full circle and shouldn't you just download an HTML page to be JavaScript's environment?


I guess what I'm looking for is something simpler -- is there?

Paint me a picture of a hypothetical simpler situation; I'm intrigued.

I think you have provided me with a clearer picture of what's going on and some things for me to consider. I need to pound some code.

Thanks for your time and insight.

tedd
--
--------------------------------------------------------------------------------
http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux