Invalid JSON response
Invalid JSON response
Hello my friends.
I'm use server-side processing with ajax request following the example manual. I'm use for work Zend Framework 1.
My script:
$(document).ready(function() {
var table = $('#dataTable').DataTable( {
"processing": true,
"serverSide": true,
"ajax": "",
"dataSrc" : ""
} );
} );
My zend action :
public function browseAction() {
$table = 'exam_result';
$primaryKey = 'id';
$columns = array(
array('db' => 'exam_id', 'dt' => 1),
array('db' => 'date', 'dt' => 0),
array('db' => 'mark', 'dt' => 2),
);
$sql_details = array(
'user' => 'root',
'pass' => '',
'db' => 'quiz',
'host' => 'localhost'
);
$json = json_encode(
Application_Model_Ajax::simple($_POST, $sql_details, $table, $primaryKey, $columns)
);
echo $json;
$id = $this->_getParam('id');
$userMapper = new Application_Model_UserMapper();
$user = $userMapper->findObject($id);
$this->view->user = $user;
}
And in the end I get (see image)
" Invalid JSON response".
How to ask for a plugin to put everything in place? (I apologize for my English)
Replies
Thank's it work !
I add
$this->getHelper('json')->sendJson($json);
and edit
Application_Model_Ajax::simple($_GET, $sql_details, $table, $primaryKey, $columns)
);