Sorry, didn’t realise you were working within a script tag.
an alternative could be to assign the value to a session variable within server connect as shown in the start of this thread then set it via php I.e.
var sig = <?php echo $_SESSION..........?>