RE: [PHP] Calling Javascript-function from php-script ...
I'm not quite sure what you mean... If Javascript were disabled then this whole argument would be moot. Since our method requires Javascript to properly function we're really not interested in that particular situation. :) There are two ways a PHP script (or any scripting language for that matter) can send input to a Javascript. One, by dynamically generating a local Javascript with the lines of code necessary to perform a certain task. Two, by sending information through the URL string to a remote Javascript which runs functions based on that information. Classic Input/Output. It doesn't matter where the input is coming from so long as the program gets what is expecting. So in this sense the two unrelated programs (one server side, one client side) are communicating, just not directly. Bottom line is the method works so I don't understand what there is to debate. See here for a working example http://www.helpelf.com/fetch_data.html It's not very sophisticated yet (all the junk left in the URL, et al). But it does what I'm talking about. You can copy paste this Javascript into any web page and it'll return the same database information gathered by the PHP script. -Kevin -Original Message- From: Alexander Skwar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 4:27 PM To: Kevin Stone Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Calling Javascript-function from php-script ... »Kevin Stone« sagte am 2002-03-19 um 14:11:42 -0700 : Not entirely true. Javascript is directly linked to HTML and HTML is directly linked to PHP so you can have PHP talk to Javascript through HTML. I still don't agree. You can of course create JavaScripts dynamically in PHP. However, PHP won't talk to JS, it's the browser which will execute the dynamically created JS and then maybe talk back to the server and thus execute some PHP code. This may seem like nitpicking, but I don't think it is. If PHP were to execute the JS, it would work even when the user had disabled JS in his browser. Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de | Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 2 days 12 hours 18 minutes -- 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
Re: [PHP] Calling Javascript-function from php-script ...
I think the point here is that it be made clear to those who might get confused that the javascript (unless it's a server-side script) is running in a browser and as such there is no way for the server to 'make a call to it by URL.' The Javascript can call the server but the server-side PHP script cannot call the client. Therefore, no PHP script can 'call' a javascript function. On Wednesday 20 March 2002 12:44 pm, Kevin Stone wrote: I'm not quite sure what you mean... If Javascript were disabled then this whole argument would be moot. Since our method requires Javascript to properly function we're really not interested in that particular situation. :) There are two ways a PHP script (or any scripting language for that matter) can send input to a Javascript. One, by dynamically generating a local Javascript with the lines of code necessary to perform a certain task. Two, by sending information through the URL string to a remote Javascript which runs functions based on that information. Classic Input/Output. It doesn't matter where the input is coming from so long as the program gets what is expecting. So in this sense the two unrelated programs (one server side, one client side) are communicating, just not directly. Bottom line is the method works so I don't understand what there is to debate. See here for a working example http://www.helpelf.com/fetch_data.html It's not very sophisticated yet (all the junk left in the URL, et al). But it does what I'm talking about. You can copy paste this Javascript into any web page and it'll return the same database information gathered by the PHP script. -Kevin -Original Message- From: Alexander Skwar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 4:27 PM To: Kevin Stone Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Calling Javascript-function from php-script ... »Kevin Stone« sagte am 2002-03-19 um 14:11:42 -0700 : Not entirely true. Javascript is directly linked to HTML and HTML is directly linked to PHP so you can have PHP talk to Javascript through HTML. I still don't agree. You can of course create JavaScripts dynamically in PHP. However, PHP won't talk to JS, it's the browser which will execute the dynamically created JS and then maybe talk back to the server and thus execute some PHP code. This may seem like nitpicking, but I don't think it is. If PHP were to execute the JS, it would work even when the user had disabled JS in his browser. Alexander Skwar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Calling Javascript-function from php-script ...
I think the point here is that I'm right and you're wrong *JUST JOKING!* Seriously you're absolutely right, a PHP script can not activate a Javascript function. What I'm saying (and what I wanted the original poster to understand) is that a PHP script CAN send input to a Javascript, and based on that input run a specific function. A Javascript can activate a PHP function in the same way. So in this way a Javascript and a PHP script can in fact communicate. (please note the preceeding a before the words Javascript and PHP.. we're not talking about the languages here only the physical scripts, because we could be talking about any two interpreted languages). *phew* Are we done yet? I really need to get back to work. LOL :D -Kevin -Original Message- From: Andrew Lopucki [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 20, 2002 10:51 AM To: Kevin Stone; [EMAIL PROTECTED] Subject: Re: [PHP] Calling Javascript-function from php-script ... I think the point here is that it be made clear to those who might get confused that the javascript (unless it's a server-side script) is running in a browser and as such there is no way for the server to 'make a call to it by URL.' The Javascript can call the server but the server-side PHP script cannot call the client. Therefore, no PHP script can 'call' a javascript function. On Wednesday 20 March 2002 12:44 pm, Kevin Stone wrote: I'm not quite sure what you mean... If Javascript were disabled then this whole argument would be moot. Since our method requires Javascript to properly function we're really not interested in that particular situation. :) There are two ways a PHP script (or any scripting language for that matter) can send input to a Javascript. One, by dynamically generating a local Javascript with the lines of code necessary to perform a certain task. Two, by sending information through the URL string to a remote Javascript which runs functions based on that information. Classic Input/Output. It doesn't matter where the input is coming from so long as the program gets what is expecting. So in this sense the two unrelated programs (one server side, one client side) are communicating, just not directly. Bottom line is the method works so I don't understand what there is to debate. See here for a working example http://www.helpelf.com/fetch_data.html It's not very sophisticated yet (all the junk left in the URL, et al). But it does what I'm talking about. You can copy paste this Javascript into any web page and it'll return the same database information gathered by the PHP script. -Kevin -Original Message- From: Alexander Skwar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 4:27 PM To: Kevin Stone Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Calling Javascript-function from php-script ... Kevin Stone sagte am 2002-03-19 um 14:11:42 -0700 : Not entirely true. Javascript is directly linked to HTML and HTML is directly linked to PHP so you can have PHP talk to Javascript through HTML. I still don't agree. You can of course create JavaScripts dynamically in PHP. However, PHP won't talk to JS, it's the browser which will execute the dynamically created JS and then maybe talk back to the server and thus execute some PHP code. This may seem like nitpicking, but I don't think it is. If PHP were to execute the JS, it would work even when the user had disabled JS in his browser. Alexander Skwar -- 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
RE: [PHP] Calling Javascript-function from php-script ...
AFAK it's not possible since PHP is server-side and I guess your JavaScript is client-side. Niklas -Original Message- From: Marcel Besancon [mailto:[EMAIL PROTECTED]] Sent: 19. maaliskuuta 2002 14:05 To: [EMAIL PROTECTED] Subject: [PHP] Calling Javascript-function from php-script ... Hi everybody, is there someone who can tell me how to call a javascript-function by a php-script. Thanks for each answer Marcel -- registered Fli4l-User #0388 -- 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
Re: [PHP] Calling Javascript-function from php-script ...
Short answer: no. Long answer: have the PHP script output javascript code to the browser. PHP = server-side Javascript = client-side Marcel Besancon wrote: Hi everybody, is there someone who can tell me how to call a javascript-function by a php-script. Thanks for each answer Marcel -- registered Fli4l-User #0388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling Javascript-function from php-script ...
Hi, i know that one is server-side and the other is client-side. But what i meant ist the following. I have a script with a form. By submitting this form and checking out some values php should call a javascript-function (such as an alert). You see the php-script shall call the javascript-function by refreshing the whole page. Bye, Marcel -- registered Fli4l-User #0388 Scott Furt [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Short answer: no. Long answer: have the PHP script output javascript code to the browser. PHP = server-side Javascript = client-side Marcel Besancon wrote: Hi everybody, is there someone who can tell me how to call a javascript-function by a php-script. Thanks for each answer Marcel -- registered Fli4l-User #0388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Calling Javascript-function from php-script ...
Then you need to do it like this: ? if ($myVal == ---) { ? script language=JavaScript alert(DOH!); /script ? }; ? But you can not make PHP call javascript functions directly. Niklas -Original Message- From: Marcel Besancon [mailto:[EMAIL PROTECTED]] Sent: 19. maaliskuuta 2002 14:20 To: [EMAIL PROTECTED] Subject: Re: [PHP] Calling Javascript-function from php-script ... Hi, i know that one is server-side and the other is client-side. But what i meant ist the following. I have a script with a form. By submitting this form and checking out some values php should call a javascript-function (such as an alert). You see the php-script shall call the javascript-function by refreshing the whole page. Bye, Marcel -- registered Fli4l-User #0388 Scott Furt [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Short answer: no. Long answer: have the PHP script output javascript code to the browser. PHP = server-side Javascript = client-side Marcel Besancon wrote: Hi everybody, is there someone who can tell me how to call a javascript-function by a php-script. Thanks for each answer Marcel -- registered Fli4l-User #0388 -- 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
Re: [PHP] Calling Javascript-function from php-script ...
PHP cannot call a javascript function. but PHP can examine the incoming variables and then output Javascript to the browser to do the appropriate work. for example, calling $text.php?this=5 pops up an alert saying this=5 test.php ? print script\n. alert('this='+. $this .);\n. /script ? Marcel Besancon wrote: Hi, i know that one is server-side and the other is client-side. But what i meant ist the following. I have a script with a form. By submitting this form and checking out some values php should call a javascript-function (such as an alert). You see the php-script shall call the javascript-function by refreshing the whole page. Bye, Marcel -- registered Fli4l-User #0388 Scott Furt [EMAIL PROTECTED] schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Short answer: no. Long answer: have the PHP script output javascript code to the browser. PHP = server-side Javascript = client-side Marcel Besancon wrote: Hi everybody, is there someone who can tell me how to call a javascript-function by a php-script. Thanks for each answer Marcel -- registered Fli4l-User #0388 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling Javascript-function from php-script ...
»Marcel Besancon« sagte am 2002-03-19 um 13:04:38 +0100 : Hi everybody, is there someone who can tell me how to call a javascript-function by a php-script. PHP creates HTML pages (mostly) which will be displayed by a client and/or receives send pages/requests from a client. There's no connection between the two. Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de | Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 2 days 8 hours 46 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling Javascript-function from php-script ...
»Marcel Besancon« sagte am 2002-03-19 um 13:19:49 +0100 : meant ist the following. I have a script with a form. By submitting this form and checking out some values php should call a javascript-function (such as an alert). You see the php-script shall call the Bad idea. On the one hand, PHP is not calling JS functions. The browser might interpret the strings PHP sends as JavaScript and act thusly. On the other hand, users who disabled JS will not see your JS alert. Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de | Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 2 days 8 hours 48 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Calling Javascript-function from php-script ...
Not entirely true. Javascript is directly linked to HTML and HTML is directly linked to PHP so you can have PHP talk to Javascript through HTML. So here's a very simple example of a Javascript and PHP script (on separate servers) talking to one other... - html titlemyhtmlpage.html/title script language=javascript if (location.search.substring(1)) { // Parse and evalulate the returning GET string. var urlStr = window.location.search.substring(1); var name = urlStr.split('=')[0]; var value = urlStr.split('=')[1]; document.write(value); } else { document.location( http://www.here.com/myphpscript.php?request=current_time;); } /script /html - - ?//myphpscript.php extract($HTTP_GET_VARS); $origin = $HTTP_REFERER; if ($request == current_time) { $information = time(); // err.. whatever the time function is in PHP header(Location: $origin?return=$information); } ? - In this example the Javascript is activated when the page is visited. If no information is being passed in the URL string then it auto-redirects to a PHP script on another server. The PHP script extracts the variables from the GET string and redirects back to the originating script with the requested information. Now when the Javascript reads it itll parse out the value and write it to the screen closing the loop. Pretty slick eh? -Kevin -Original Message- From: Alexander Skwar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 12:54 PM To: Marcel Besancon Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Calling Javascript-function from php-script ... »Marcel Besancon« sagte am 2002-03-19 um 13:04:38 +0100 : Hi everybody, is there someone who can tell me how to call a javascript-function by a php-script. PHP creates HTML pages (mostly) which will be displayed by a client and/or receives send pages/requests from a client. There's no connection between the two. Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de | Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 2 days 8 hours 46 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Calling Javascript-function from php-script ...
»Kevin Stone« sagte am 2002-03-19 um 14:11:42 -0700 : Not entirely true. Javascript is directly linked to HTML and HTML is directly linked to PHP so you can have PHP talk to Javascript through HTML. I still don't agree. You can of course create JavaScripts dynamically in PHP. However, PHP won't talk to JS, it's the browser which will execute the dynamically created JS and then maybe talk back to the server and thus execute some PHP code. This may seem like nitpicking, but I don't think it is. If PHP were to execute the JS, it would work even when the user had disabled JS in his browser. Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de | Jabber: [EMAIL PROTECTED] iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 2 days 12 hours 18 minutes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php