title: dojo.xhrPost and Zend Framework action, no POST data, not using a form
body: <p>I'm trying to send some data via dojo.xhrPost to an Zend Controller Action. I can see the data being sent in Firebug console. However, when inspecting the post data, the array is empty.</p>
  
  <p>I'm not sure if it is possible to send an arbitrary string of data via dojo.xhrPost without using a form. This is probably a very n00b mistake. In any case, I'll post my code here and see what you all think.</p>
  
  <p>In my layout script I have:</p>
  
  <pre><code>&lt;?php
  
      $sizeurl = $this-&gt;baseUrl() . '/account/uisize';
  
  ?&gt;
  
  function resizeText(multiplier)
  {
      if (document.body.style.fontSize == "")
      {
          document.body.style.fontSize = "1.0em";
      }
      document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.1) + "em";
      var size = document.body.style.fontSize;
      var xhrArgs = {
                      url: "&lt;?= $sizeurl; ?&gt;",
                      postData: size,
                      handleAs: "text"
                  }
      dojo.xhrPost(xhrArgs);
  }
  </code></pre>
  
  <p>Then my action is:</p>
  
  <pre><code>public function uisizeAction()
  {
      $this-&gt;_helper-&gt;viewRenderer-&gt;setNoRender();
      $this-&gt;_helper-&gt;layout-&gt;disableLayout();
  
      print_r($_POST);
      $request = $this-&gt;getRequest();
  
      if ($request-&gt;isXmlHttpRequest())
      {
          $postdata = $request-&gt;getPost();
          print_r($postdata);
          if ($postdata)
          {
              $user = new Application_Model_DbTable_User();
              $user-&gt;updateSize($postdata);
          }
      }
  }
  </code></pre>
  
  <p>I'm pretty sure that post data from a form is an array with the form elements' names as the keys. When looking at the dojo.xhrPost examples on the dojo campus web site (<a href="http://docs.dojocampus.org/dojo/xhrPost" rel="nofollow noreferrer">http://docs.dojocampus.org/dojo/xhrPost</a> second one to be precise), it looks as if I can just send a string of data. How do I access this data from a Zend Controller Action?</p>
  
  <p>I'm using ZF 1.10 and Dojo 1.4.2</p>
  
  <p>Thanks for your help!</p>
  
  <p>PS
  I'd try to ask on one of the related questions, but I cannot seem to comment.</p>