json testing suggestions [message #184541] |
Wed, 08 January 2014 01:33  |
r.mariotti
Messages: 17 Registered: December 2011
Karma: 0
|
Junior Member |
|
|
Pls help jolt my old memory with this? Trying to work on some old php
progs that output using the json_encode function on a NEW install of
Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
using as the source for the json_encode it looks just fine. However,
firebug is showing non response.
I checked with phpinfo and it shows that I do have json installed and
active and when I try to run the target program I also receive just
errors.
So my question is: can someone recommend some ways to properly debug
the ajax/json process? I seem to remember firebug once having some
features available to examine the response from a js call but I don't
see it now.
BTW - having just recently upgraded from 10.04 to 13.10 I've run into
other issues with compatibiity. Hopefully they are getting resolved
and this is just one of them.
Thanks for any advice/suggestions.
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
|
|
|
|
Re: json testing suggestions [message #184543 is a reply to message #184541] |
Wed, 08 January 2014 04:23   |
John Smith
Messages: 7 Registered: January 2014
Karma: 0
|
Junior Member |
|
|
On Tue, 07 Jan 2014 20:33:21 -0500, BobMCT <r(dot)mariotti(at)fdcx(dot)net>
wrote:
> So my question is: can someone recommend some ways to properly debug
> the ajax/json process? I seem to remember firebug once having some
> Thanks for any advice/suggestions.
>
> ---
> This email is free from viruses and malware because avast! Antivirus protection is active.
> http://www.avast.com
Hi,
I still use json_encode like crazy, it works fantastic, no issues so
far;
You need to test two places
- On the php, ensure that you actually get something rendered. Are you
sure the php array or object is valid ? That is simple to test, put a
breakpoint there and run in debug, you figure out fast
- On the browser side, I assume you use some javascript framework,
jQuery or something. If you don't, please do it, it saves headache and
time. It is possible that the json crashes when it gets evaluated,
although if it is generated with json_encode this is less likely to
happen: locate you callback function and place a breakpoint in the
javascript code and see what comes.
Personally rather than leaving jQuery to eval my json, I prefer to
take the response as text and eval it myself - in between these two
likes of code, you can always alert(responsetext) and see what comes
back.
That always worked for me...
--
John
|
|
|
|
|
|
|
|
|
|
|
|
Re: json testing suggestions [message #184553 is a reply to message #184542] |
Fri, 10 January 2014 03:43  |
r.mariotti
Messages: 17 Registered: December 2011
Karma: 0
|
Junior Member |
|
|
On Tue, 07 Jan 2014 21:48:35 -0500, Richard Damon
<Richard(at)Damon-Family(dot)org> wrote:
> On 1/7/14, 8:33 PM, BobMCT wrote:
>> Pls help jolt my old memory with this? Trying to work on some old php
>> progs that output using the json_encode function on a NEW install of
>> Ubuntu 13.10. I'm NOT getting any output. If I dump the array I'm
>> using as the source for the json_encode it looks just fine. However,
>> firebug is showing non response.
>>
>> I checked with phpinfo and it shows that I do have json installed and
>> active and when I try to run the target program I also receive just
>> errors.
>>
>> So my question is: can someone recommend some ways to properly debug
>> the ajax/json process? I seem to remember firebug once having some
>> features available to examine the response from a js call but I don't
>> see it now.
>>
>> BTW - having just recently upgraded from 10.04 to 13.10 I've run into
>> other issues with compatibiity. Hopefully they are getting resolved
>> and this is just one of them.
>>
>> Thanks for any advice/suggestions.
>>
>
> Have you checked the server logs to make sure the page being accessed
> isn't generating a fatal PHP error and stopping the script?
Thanks for all the responses/suggestions. Being a newly installed
version of Ubuntu 13.10 Server I DID have to explicitly install the
php5-json package. Guess what? Now it works - gee.
And just one comment to "pointed ears" - get a life, huh!
|
|
|