title: Inserting Advance Custom Fields in Javascript
body: <p>I have a file called smart screen-front.php. Inside this file I am trying to output some php variables inside some javascript:</p>
  
  <pre><code>&lt;?php
  header("Content-type: text/javascript"); // This bit must come first!
  ?&gt;
  &lt;?php $ssimage1 = get_field('smartscreen_slider_image_1'); ?&gt;
  &lt;?php $ssimage2 = get_field('smartscreen_slider_image_2'); ?&gt;
  &lt;?php $ssimage3 = get_field('smartscreen_slider_image_3'); ?&gt;
  &lt;?php $ssimage4 = get_field('smartscreen_slider_image_4'); ?&gt;
  &lt;?php $ssimage5 = get_field('smartscreen_slider_image_5'); ?&gt;
  &lt;?php $ssimage6 = get_field('smartscreen_slider_image_6'); ?&gt;
  &lt;?php $ssimage7 = get_field('smartscreen_slider_image_7'); ?&gt;
  &lt;script type="text/javascript"&gt;
   jQuery(document).ready(function () {
  
              jQuery.supersized({
  
                  // Functionality
                  slide_interval          :   10000,      // Length between transitions
                  transition              :   1,          // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
                  transition_speed        :   1000,
                  keyboard_nav            :   1,
  
                  // Speed of transition
  
                  // Components
                  slide_links             :   'blank',    // Individual links for each slide (Options: false, 'num', 'name', 'blank')
                  slides                  :   [           // Slideshow Images
                      {image : &lt;?php echo $ssimage1; ?&gt;, title : '&lt;div class="slider-caption"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;',  thumb : '', url : ''} ,
                      {image : &lt;?php echo $ssimage2; ?&gt;, title : '&lt;div class="slider-caption"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;', thumb : '', url : ''} ,
                      {image : &lt;?php echo $ssimage3; ?&gt;, title : '&lt;div class="slider-caption"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;', thumb : '', url : ''} ,
                      {image : &lt;?php echo $ssimage4; ?&gt;, title : '&lt;div class="slider-caption"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;',  thumb : '', url : ''} ,
                      {image : &lt;?php echo $ssimage5; ?&gt;, title : '&lt;div class="slider-caption"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;',  thumb : '', url : ''},
                      {image : &lt;?php echo $ssimage6; ?&gt;, title : '&lt;div class="slider-caption"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;',  thumb : '', url : ''} ,
                      {image : &lt;?php echo $ssimage7; ?&gt;, title : '&lt;div class="slider-caption"&gt;&lt;h2&gt;&lt;/h2&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;',  thumb : '', url : ''}
  
                      ]
              });
          }
  
  );
  &lt;/script&gt; 
  </code></pre>
  
  <p>This is not outputting the php variables. What am I doing wrong. </p>