Jump to content

PHP session id to Javascript in Internet Explorer


tmk4php

Recommended Posts

Hi,

 

I'm trying to pass a PHP variable holding a session ID to Javascript.  I've gotten it to work successfully in every browser except Internet Explorer (I've only tested in IE7 and IE8beta, nothing earlier) by passing it through a hidden input field.  Here is the code:

 

  <input type="hidden" id="dataxml" value="<?php echo $xmlsheet; ?>">

</form>

  <script type="text/javascript"> 

    //other code

    myChart.setDataURL("temp/Data_" + dataxml.value);

  </script> 

 

$xmlsheet is holding the session ID.  IE gives me an error saying that my 'dataxml' is undefined.

 

Does anyone know why IE is throwing this error, or any way around it?  Right now I'm just telling users not to use IE...

 

what happens if you change

myChart.setDataURL("temp/Data_" + dataxml.value);

to

myChart.setDataURL("temp/Data_" + document.getElementById('dataxml').value);

 

or possibly

myChart.setDataURL("temp/Data_<?php echo $xmlsheet; ?>");

 

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.