I suspect you need to be careful how you use the term "call".  It is
possible for javascript, which runs on the "client side" or in the browser,
to cause the browser to perform a form submit, and if the action field of
the form points to a php script on a server "server side", then the php code
will execute on the server, processing the form content on the server and
sending new results in the form of html and javascript back to the browser
"client side".

That may have appeared to you as a "call" but most PHP developers would not
use that term.  Two items you may not have control of yet, is that in this
case the PHP always runs on the server machine, and javascript always runs
on the browser machine, and the only way they can both execute on the same
machine, is if the server and browser are both on the same machine.  The PHP
will always run in the memory space of the server, and the javascript runs
in the memory space of the browser.

The only exceptions to the last statement is when the PHP runs from the
command line, at which time it is not communicating to a browser (often
referred to as a CGI, even though it isn't) and the only time, I believe,
that javascript can execute on a server is using an old product, that I have
only heard of but never used, referred to as "server side" javascript.

hope this helps,

Warren Vail
[EMAIL PROTECTED]


-----Original Message-----
From: Nitin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 12, 2003 10:52 PM
To: Jake McHenry; [EMAIL PROTECTED]
Subject: Re: [PHP] Calling PHP functions from within javascript


First thing is, it's possible, i've done it in the past myself, it's just
not working due to some reason. Second, functioning cann't be achieved with
javascript, cauz it's DB related.

anyway thanx for ur reply
Nitin

----- Original Message -----
From: "Jake McHenry" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 13, 2003 12:16 PM
Subject: RE: [PHP] Calling PHP functions from within javascript


> > -----Original Message-----
> > From: Nitin [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, November 13, 2003 1:35 AM
> > To: PHP-General
> > Subject: [PHP] Calling PHP functions from within javascript
> >
> >
> > Hi all,
> >
> > can anybody tell me how to call PHP functions from within
> > javascript, as I want my PHP function to be interactive. I
> > need to call the function written in the same page, with the
> > values selected by the user
> >
> > Thanx in advance
> >
> > Nitin
> >
>
> Someone correct me if I'm wrong, but this isn't possible unless you
> have your javascript continuously refreshing the page, and changing
> the url, or posting data. PHP is server side, so the only way for php
> script to be executed is when the page loads. It might be more
> productive if you create the functions you want executed in javascript
> instead of php.
>
>
>
> Thanks,
>
> Jake McHenry
> Nittany Travel MIS Coordinator
> http://www.nittanytravel.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

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

Reply via email to