global how .. that doesnt really explain much

If you mean globaly accessible to javascript then you need to do something 
like

<?php
$bar='bar';
echo("<script>foo=$bar</script>");

?>
....

<script>alert(foo);</script>

...

otherwise please be more specific

Thanks
Alex


----- Original Message ----- 
From: "marioosh" <marioosh....@gmail.com>
To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com>
Sent: Tuesday, March 03, 2009 12:38 PM
Subject: [Proto-Scripty] Ajax.Request and php global variable


>
> I have a code as below:
>
> test1.php:
> ----------
> <html>
>    <head>
>        <meta http-equiv="Content-Type" content="text/html;
> charset=UTF-8">
>        <script type="text/javascript" src="resources/scriptaculous-
> js-1.8.2/lib/prototype.js" ></script>
>        <script type="text/javascript" src="test1.js" ></script>
>    </head>
> <body>
> <?php
> // want to be global, but how???
> $var = 'test';
> ?>
>
> <div id="debug"></div>
> </body>
> </html>
>
>
> test1.js:
> ----------
> Event.observe(document,'dom:loaded', function() {
> new Ajax.Updater('debug','test2.php', {
> onComplete: function() {
> }
> });
> });
>
>
> test2.php:
> ----------
> <?php
>  echo "var = ".$var;
> ?>
>
> (http://pastie.org/405875 for better view)
>
> How to make $var to work as global within Ajax.Request ?? Is this
> possible ?
> Thanks in advance for help.
>
> >
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to