Jump to content

[SOLVED] php var into js = headache


abazoskib

Recommended Posts

if i echo the statement without it being run as javascript it loooks like it should run.

here is the echo

 

<script type="text/javascript">setTimeout(extendSession, 10798000, "d8aee766_addf_4cc5_b51c_17294215f928");</script>

 

extendSession runs after the specified timeout perfectly, however the parameter does not get passed as its value, it gets passed as 'undefined'

A couple of questions for you regarding the following code

<script type="text/javascript">
setTimeout(
  extendSession, 
  10798000, 
  "d8aee766_addf_4cc5_b51c_17294215f928"
);
</script>

the third arguement is optional and the values allowed are (JScript | VBScript | JavaScript)

That third value does not make sense here.

 

What does the extendSession function look like?

 

maybe your javascript should look like:

<script type="text/javascript">
setTimeout('extendSession( "<?php echo $id; ?>")', <?php echo $timeLeft; ?>);
</script>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.