jeudi 26 mars 2015

uncaught exception: out of memory in Ajax Process


I got a problem I am submitting a simple form that has a small data and when I checked in the console tab the URL of ajax seems to be working but after the ajax is success it is redirected to my homepage and from the console tab I have this weird error:



uncaught exception: out of memory


In my ajax I have this simple code only:



$("#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!!!');
}
});

});


In my PHP controller I have this function



public function writeSubComment() {

$json = array();

$json['test'] = $this->request->post['sample'];

$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));

}




Aucun commentaire:

Enregistrer un commentaire