title: javascript - pass object via post
body: <p>I have an object that looks like this</p>
  
  <p>var obj = {
    p1 : true,
    p2 : true,
    p3 : false
  }</p>
  
  <p>I am looking to try and pass this object as part of a post request.</p>
  
  <p>however on the other end (in php) all I get is</p>
  
  <blockquote>
    <p>[object Object] </p>
  </blockquote>
  
  <p>How can I send an object via post?</p>
  
  <p>basically what I am trying to do is</p>
  
  <p>I have an input that is hidden and is created like so</p>
  
  <p><code>&lt;input id="obj" type="hidden" name="obj[]"&gt;</code></p>
  
  <p>which is part of a hidden form.</p>
  
  <p>when a button is pressed I have</p>
  
  <pre><code>$(#obj).val(obj);
  $('form').submit();
  </code></pre>
  
  <p><hr />
  Please no suggestions to use ajax as I must do it this way as it is to download a dynamically created file.</p>