![profile picture](/public/style_images/master/profile/default_large.png)
Unexpected token json
- Single Page
Posted 09 August 2018 - 20:29 PM
I followed the exemple instructions to setup my first crud without composer and when load the page i got this error:
SyntaxError: unexpected token < in json at position 2
On chrome console:
[Violation] Forced reflow while executing javascript
Please, should anyone help me?
Or tell me how to debug this and how to solve this error?
Posted 13 August 2018 - 00:02 AM
Hi Julio!
Are you using CodeIgniter as framework? I can help you if that's the case.
Lara
Posted 14 August 2018 - 22:43 PM
Yes. I'm using CI.
About the error i fixed it.
Thanks.
Posted 27 August 2018 - 16:06 PM
Hi, i have the same error in this CRUD, can un share your solution?
$crud = $this->GCRUD_getGroceryCrudEnterprise(); $crud->setTable('login_usu'); $crud->setSubject("Datos del usuario","Lista de usuarios"); $crud->setTheme("bootstrap-v4"); $crud->columns(['id','nombre','email']); $crud->fields(['id','nombre','email','clave']); $crud->setPrimaryKey('id',"login_usu"); $crud->displayAs([ 'id' => 'ID', 'nombre' => 'Nombre', 'email' => 'eMail', 'clave' => 'Clave' ]); $crud->defaultOrdering('login_usu.nombre', 'asc'); $crud->requiredFields(['nombre','clave','email']); $crud->readOnlyFields(['id']); $output = $crud->render(); $this->load->view('login_crud.php',$output);
Posted 28 August 2018 - 10:58 AM
$this->GCRUD_output('fullscreen_crud.php',$output);
where
function GCRUD_output($template = "",$output = null) { if (isset($output->isJSONResponse) && $output->isJSONResponse) { header('Content-Type: application/json; charset=utf-8'); echo $output->output; exit; } $this->load->view($template,$output); }