title: Using php variable in jQuery Script
body: <p>I am trying to get this code to work but cannot figure out how to make it work correctly. I think I am close though. This code works fine on my page:</p>
  
  <pre><code>var entryID = $(this).attr('id');
  
      if ("&lt;?php echo $locations[2]['floor']; ?&gt;" == 'firstFloor' ) {
          $("#drawTable").attr("style", "background:url(\'images/firstFloor.jpg\') 50% / 100% no-repeat;");
      }
      else if ("&lt;?php echo $locations[2]['floor']; ?&gt;" == 'secondFloor' ) {
          $("#drawTable").attr("style", "background:url(\'images/secondFloor.jpg\') 50% / 100% no-repeat;");
      }
  </code></pre>
  
  <p>I am trying to make the array changeable by using the entryID instead of just a number like '2'. I do not think that I am concatenating correctly below. If you can help It would be much appreciated! Thank you</p>
  
  <pre><code>var entryID = $(this).attr('id');
  
      if ("&lt;?php echo $locations . "[";?&gt;" +entryID+ "&lt;?php echo "]['floor']"; ?&gt;" == 'firstFloor' ) {
          $("#drawTable").attr("style", "background:url(\'images/firstFloor.jpg\') 50% / 100% no-repeat;");
      }
      else if ("&lt;?php echo $locations . "[";?&gt;" +entryID+ "&lt;?php echo "]['floor']"; ?&gt;" == 'secondFloor' ) {
          $("#drawTable").attr("style", "background:url(\'images/secondFloor.jpg\') 50% / 100% no-repeat;");
      }
  </code></pre>