title: Pass PHP object via AJAX
body: <p>I was wondering what the best way would be to pass a php object via AJAX.</p>
  
  <p>for example</p>
  
  <pre><code>//objectClass = objectClass.php
  $obj = new objectClass();
  &lt;a href="javascript:getOutput("some variable", $obj);
  </code></pre>
  
  <p>As the other file i.e. output.php (called through ajax in getOutput() function) needs to access objectClass.php as well, what is the best way to access $obj?</p>
  
  <p>I tried to jscon_encode($obj) then decode but not working.</p>
  
  <p>Thanks in advance</p>