is there any way to make php and javascript talk?
-
- Posts: 504
- Joined: Sat May 07, 2005 8:03 am
- Contact:
-
- Posts: 504
- Joined: Sat May 07, 2005 8:03 am
- Contact:
emm, it is easy. i'll shouw you simple example:
Create javascipts as you create you html page, with echo or somthing like that
or in php file for jscript you can do like
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
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>";
?>
or in php file for jscript you can do like
Code: Select all
window.resize(<?echo "$w, $h"?>);
Simple


-
- Posts: 504
- Joined: Sat May 07, 2005 8:03 am
- Contact:
GREAT!!!Lixas wrote:emm, it is easy. i'll shouw you simple example:
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 phpCode: 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"?>);
Simplegood luck
it really works
thanks
-
- Posts: 504
- Joined: Sat May 07, 2005 8:03 am
- Contact:
oooh, yes, i got thattsj5j 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.
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