I have some google survey code that I have included in one of my panel node variants. The js code has some php in it, to include the node nid and node title. Im trying to move this code, declared in a script tag, right under the tag of the document via js/jquery. I have fussed and fussed with this for a couple of days on and off, and I still cant figure it out. I know the solution is probably really simplem bu please help!

The code:

<script type="text/javascript"> 
(function() { 
  var ARTICLE_URL = '<?php print "http://www.example.com/".$url; ?>'; 
  var CONTENT_ID = '<?php print $nid; ?>'; // Optional or leave empty 
    '<scr'+'ipt '+ 
    (CONTENT_ID ? '&amp;cid='+encodeURIComponent(CONTENT_ID) : '')+ 
    '&amp;random='+(new Date).getTime()+ 
    '" type="text/javascript">'+'\x3C/scr'+'ipt>'); 

Basically I need the js script at document load time, with rendered php, to move under the body tag.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.