title: Passing PHP variable to a JavaScript hyperlink function
body: <p>I’m trying to pass a variable from a PHP array to a JavaScript function. In the PHP array I have:</p>
  
  <pre><code>echo '&lt;a href="JavaScript:void(0);" onclick="manager(&amp;#39;';echo $Company;echo'&amp;#39;)"&gt;'.$Manager.'&lt;/td&gt;
  </code></pre>
  
  <p>If I use the function,</p>
  
  <pre><code>&lt;script type="text/jscript"&gt;
  function manager(Value){
  alert(Value);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The hyperlink gives me a message box with the correct company for each row, so the PHP part seems OK.  Now I want to pass the Company to a page and return the result to a div. I’ve tried using,</p>
  
  <pre><code>&lt;script type="text/jscript"&gt;
  function manager() {
  $.post('manager.php', { Company: var.Value},
  function (output) {
  $('#info2').html(output).show();
  });
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>with some variations like “Company: this.Value” and “Company: (Value)” and another method like,</p>
  
  <pre><code>&lt;script type="text/jscript"&gt;
  function manager(Value){
  $("#info2").load("manager.php?"+this.manager.Value);
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>If I put the company in manually like “$("#info2").load("manager.php?Company=ACME”);” it works so I know the manager.php page is OK. I’m pretty sure I just don’t know how to pass the variable though the function correctly. Any ideas? Thanks.</p>