title: uncaught exception: out of memory in Ajax Process
body: <p>I got a problem I am submitting a simple form that has a small data and when I checked in the <code>console</code> tab the URL of ajax seems to be working but after the ajax was processed it will alert an error and it is redirected to my homepage and from the console tab I have this <code>weird error</code>:</p>
  
  <blockquote>
    <p>Uncaught exception: out of memory</p>
  </blockquote>
  
  <p>In my ajax I have this simple code only:</p>
  
  <pre><code>$("#add-comment").on('click', function() {
  
      var id = $('input[name=\'review_id\']').val();
      var customer_id = $('input[name=\'customer_id\']').val();
      var $comment = $('textarea[name=\'user_comment\']').val();
  
      var sample = "test";
  
      $.ajax({
          url: 'index.php?route=product/product/writeSubComment',
          type: 'post',
          dataType: 'json',
          data: { text: sample },
          beforeSend: function() {
  
          },
          success: function(data) {
              console.log(data.test);
          },
          error: function() {
              alert('ERROR!!!');
          }
      });
  
  });
  </code></pre>
  
  <p>In my PHP controller I have this function</p>
  
  <pre><code>public function writeSubComment() {
  
      $json = array();
  
      $json['test'] = $this-&gt;request-&gt;post['text'];
  
      $this-&gt;response-&gt;addHeader('Content-Type: application/json');
      $this-&gt;response-&gt;setOutput(json_encode($json));
  
  }
  </code></pre>