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'

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.