How can I debug "Invalid JSON response"
How can I debug "Invalid JSON response"
geist0
Posts: 10Questions: 2Answers: 0
Hello!
I get an << Invalid JSON response>> error but have no response from server - debuger shows empty response.
Regards,
Rafal
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Did you follow the link that the error gives: http://datatables.net/tn/1 ? It shows how you can debug that issue.
Allan
Hello Allan.
Thank you for you fast response :)
Answering you question: yes, I am quite familiar with ff debuger. The problem is that "Response" tab shows empty response (in Firebug there is even no Response Tab). Looks like server send nothing.
This problem is probably connected with environment I am working. I have no problem working in a local network but opening page from server via vpn error occurs.
It occurs on table/editor posting via object-style php; two another tables working with my own "flat" scripts work well.
Rafal
Here are queries, I got from editor_sql:
SELECT
MARKTWO_Task
.id
as 'MARKTWO_Task.id',MARKTWO_Task
.id
as 'MARKTWO_Task.id',MARKTWO_Task
.name
as 'MARKTWO_Task.name',MARKTWO_TaskType
.name
as 'MARKTWO_TaskType.name',MARKTWO_Task
.type_id
as 'MARKTWO_Task.type_id',MARKTWO_Task
.appear_date
as 'MARKTWO_Task.appear_date',MARKTWO_Task
.prev_task_id
as 'MARKTWO_Task.prev_task_id',MARKTWO_Task
.description
as 'MARKTWO_Task.description'FROM
MARKTWO_Task
LEFT JOIN
MARKTWO_TaskType
ONMARKTWO_TaskType
.id
=MARKTWO_Task
.type_id
SELECT DISTINCT
id
as 'id',name
as 'name' FROMMARKTWO_TaskType
SELECT MARKTWO_Task.id as dteditor_pkey, MARKTWO_TaskOwner_MAP.owner_id as owner_id, MARKTWO_TaskOwner_MAP.task_id as task_id FROM MARKTWO_Task as MARKTWO_Task JOIN
MARKTWO_TaskOwner_MAP
ONMARKTWO_TaskOwner_MAP
.task_id
=MARKTWO_Task
.id
and ajax url source:
Editor::inst( $db, 'MARKTWO_Task' )
->fields(
Field::inst('MARKTWO_Task.id as id'),
Field::inst('MARKTWO_Task.name as name')
->validator('Validate::notEmpty', array("message" => "Nazwa nie może być pusta"))
->validator('Validate::unique', array("message" => "Lista o takiej nazwie już istnieje")),
Field::inst('MARKTWO_TaskType.name as type'),
Field::inst('MARKTWO_Task.type_id as type_id')
->options('MARKTWO_TaskType', 'id', 'name'),
Field::inst('MARKTWO_Task.appear_date as date'),
Field::inst('MARKTWO_Task.prev_task_id as prev_task_id'),
Field::inst('MARKTWO_Task.description as description')
)
->leftjoin('MARKTWO_TaskType', 'MARKTWO_TaskType.id', '=', 'MARKTWO_Task.type_id')
->join(
Mjoin::inst('MARKTWO_TaskOwner_MAP')
->name('Owners')
->link('MARKTWO_Task.id', 'MARKTWO_TaskOwner_MAP.task_id')
->fields(
Field::inst('owner_id'),
Field::inst('task_id')
)
)
->process($_POST)
->json();
Sounds like a server error in that case. Have you checked your server's error logs to see if there is any information shown there?
Allan
No, not yet but I will; it's a long time process as I need to ask admin to send me logs ;)
Thanks,
Rafal
Dear Allan,
I have checked server error log and it doesn't return any error regarding mentioned script. Finally I made such test:
I addedd some echo on the begining with Polish diacritics to ensure that is not a coding problem (isn't it?):
And responses are:
From local server:
dópą{"data":[{"DT_RowId":"row_1","id":"1","name":"Super ...
From outside server:
dópą
Have you any idea, where do I need to look?
Kind regards,
Rafal
So you have this working on one server and not the other? What is the difference between the servers? What version of PHP are they running for example.
Allan
First one: Synology DSM 5.2, Apache 2.2, PHP 5.5 - working properly
Second one: FreeBSD, Apache 2, PHP 5.6 - not working
Editor should certainly work on a PHP 5.6 server, so I'm afraid I don't have an immediate answer for you. All I can really suggest, in the absence of other information, is to enable all debugging options in your PHP and check the error log.
It might be worth putting the
echo("dópą");
after theuse
statement. I'm surprised your PHP isn't giving an error about that at least.Allan
Allan,
I have put
echo
just after thenew
statement and response is empty:Rafal
Do you mean the
use
statement?What you are seeing very much suggests that there is an error in the server configuration - particularly if it works for you on a different server.
Have you enabled all possible debugging in PHP? It really should show an error if something is going wrong.
Allan
Oh, pardon! Yes after
use
statement.Allan, many thanks for you support and help; finally I have found the problem and it was an error in completelly different script - undefined variable. I don't understant this behaviour but removeing this - seemingly unrelated - error helped!
Thank you for such fantastic library :)
Regards,
Rafal