is there any way to make php and javascript talk?

Any problem with PHP can be disscused here
kaos_frack
Posts: 504
Joined: Sat May 07, 2005 8:03 am
Contact:

is there any way to make php and javascript talk?

Post by kaos_frack »

does any one have any idea how to achieve that?


Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

what do you mean with your question? You mean, pull php's variables to javascript?
Maybe you could detail what you need ?
Image
kaos_frack
Posts: 504
Joined: Sat May 07, 2005 8:03 am
Contact:

Post by kaos_frack »

yes, i mean sending a variable from one to other and call a function
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

emm, it is easy. i'll shouw you simple example:

Code: Select all

<?
$message="Messages variable with content";
echo "<script language=\"javascript\" type=\"text/javascript\">";
echo "function notify(msg)" //we are creating a javascript function
echo "{alert(msg);}";
echo "notify('".$message."')";
echo "</script>";
?>
Create javascipts as you create you html page, with echo or somthing like that

or in php file for jscript you can do like

Code: Select all

window.resize(<?echo "$w, $h"?>);
and the versatile- transfer variables from javascript to php you can with $_GET or with $_COOKIE, i've never have such a problem, how to transfer from javascript to php

Simple :) good luck
Image
kaos_frack
Posts: 504
Joined: Sat May 07, 2005 8:03 am
Contact:

Post by kaos_frack »

Lixas wrote:emm, it is easy. i'll shouw you simple example:

Code: Select all

<?
$message="Messages variable with content"]

Create javascipts as you create you html page, with echo or somthing like that

 or in php file for jscript you can do like [code]window.resize(<?echo "$w, $h"?>);
and the versatile- transfer variables from javascript to php you can with $_GET or with $_COOKIE, i've never have such a problem, how to transfer from javascript to php

Simple :) good luck
GREAT!!!
it really works
thanks
mzikawy
Posts: 111
Joined: Wed Jan 18, 2006 1:01 am
Contact:

Post by mzikawy »

man u must have knowlege about the diffrent languages as " php , javascript "

to change the variables bettwen them .
The Life is a very Big surprise ... Try to believe it .
tsj5j
Posts: 25
Joined: Tue Feb 14, 2006 12:49 pm

Post by tsj5j »

Its capable, but its really limited to the passing of variables.

Javascript is client-based, php is server-based, they aren't really made to co-operate.
kaos_frack
Posts: 504
Joined: Sat May 07, 2005 8:03 am
Contact:

Post by kaos_frack »

tsj5j wrote:Its capable, but its really limited to the passing of variables.

Javascript is client-based, php is server-based, they aren't really made to co-operate.
oooh, yes, i got that
javascript is interpreted by the browser
and whenever you **** any link the javascript is stopped
then the php interpreter does the job which is on the server
so whenever one of them is active the other is inactive
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

ya kaos_frack, you understood right, php is server sided, js is client sided
Image
uz
Posts: 140
Joined: Sat Dec 24, 2005 5:32 pm

Post by uz »

really i did not get anything
what is your aim?
Post Reply