I am currently polishing my program, but I notice that it's a bit slow because most of it are ajax requests. My question is that, are there any performance issues with regards to using echo over using CI output class when using ajax?
assume this is my ajax request:
$.post(base_url+'ajax')
.done(function(res){
res = JSON.parse(res);
alert('res.message');
});
when using ECHO:
<?php
function ajax_response() { // inside my controller
echo json_decode(array('message' => "Hello world"));
}
?>
when using CI output class:
<?php
function ajax_response() { // inside my controller
$this->output
->set_content_type('application/json')
->set_output(json_encode( array('message' => 'Hello world' ) ));
}
?>
I would truly appreciate your help. thanks!