title: How to get the response after a POST request in CasperJS
body: <p>I have this very simple code to read the response from a server endpoint after a post request. Actually I'm saving a data to a database and wait for a response before going to next step</p>
  
  <pre><code>casper.open('http://example.com/ajax.php, {
      method: 'POST',
      data: {
          'title': '&lt;title&gt;',
          'unique_id': '&lt;unique_id&gt;'
      }
  });
  </code></pre>
  
  <p>on ajax.php file I'm trying to echo the POST request in a simple way.
  this will let me know easily if I'm getting the right response from the server.</p>
  
  <pre><code>echo json_encode($_POST);
  </code></pre>
  
  <p>I tried these snippets but I'm unable to get the response. </p>
  
  <pre><code>casper.on('page.resource.received', function(resp){
      this.echo(JSON.stringify(resp, null, 4));
  });
  
  casper.on('http.status.200', function(resp){
      this.echo(JSON.stringify(resp, null, 4));
  });
  
  casper.on('resource.received', function(resp) {
      this.echo(JSON.stringify(resp, null, 4));
  });
  </code></pre>