title: Check variable in javascript with php variable
body: <p>I have the php page with javascript code inside it. 
  If I have php variable retrieved by back-end server, can it be passed in javascript code? 
  For instance, if I want to check the flag(php variable) inside the javascript code, do I need to hardcode it inside the javascript?
  Below are the "checkServiceCategory"? (Should it be Dynamic or static)</p>
  
  <pre><code>&lt;?php
  foreach ($result as $id=&gt;$value) {
  if($value[0]-&gt;isServiceCategory)
  return true;
  }
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>isEmptyUploadFile(function(r)
  {
  var checkServiceCategory=document.getElementById('category-group').value;
  if(checkServiceCategory!=85 &amp;&amp; (fileList == null || fileList.length == 0))
  {
  $("#uploadImgError").html('&lt;em&gt;&lt;span style="color:red"&gt; &lt;i class="icon-cancel-1 fa"&gt;&lt;/i&gt; Please Upload at least one image!&lt;/span&gt;&lt;/em&gt;');
  location.href = "#uploadImgError";
  return false;
  }
  else 
  </code></pre>