Thanks Rick, it helped.
also I'll do some reading about AJAX (as soon as I can..)
Regards
Mauricio
On Sat, 2005-08-06 at 11:58, Rick Emery wrote:
> Quoting Mauricio Pellegrini <[EMAIL PROTECTED]>:
>
> > Hi ,
> > I wonder if it's possible to retrieve the value from a php session
> > variable from within a javascript function.
>
> I'm no PHP expert, but I'll give it a try (there are plenty of smart
> people on this list who will correct me if Im wrong :-)
>
> > Does anyone have any ideas about this?
>
> Yes, two of the top of my head.
>
> 1. You can send the session variable to the client along with the script.
>
> ex.
> function doSomething()
> {
> sessVar = <?php print($_SESSION['variable']); ?>;
>
> // Do some stuff.
> }
>
> Of course, sessVar won't be updated if the session variable changes
> unless the script is reloaded.
>
> 2. My favorite, but probably overkill. Write a php page that outputs
> the session variables (as XML would be cool). Then use xmlhttprequest
> to retrieve them from javascript (Google AJAX for more information).
>
> Hope this helps,
> Rick
> --
> Rick Emery
>
> "When once you have tasted flight, you will forever walk the Earth
> with your eyes turned skyward, for there you have been, and there
> you will always long to return"
> -- Leonardo Da Vinci
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php