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 #184542 is a reply to message #184541] |
Wed, 08 January 2014 02:48 |
Richard Damon
Messages: 58 Registered: August 2011
Karma: 0
|
Member |
|
|
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?
|
|
|
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 #184544 is a reply to message #184541] |
Wed, 08 January 2014 04:24 |
John Smith
Messages: 7 Registered: January 2014
Karma: 0
|
Junior Member |
|
|
> Thanks for any advice/suggestions.
>
> ---
> This email is free from viruses and malware because avast! Antivirus protection is active.
> http://www.avast.com
BTW, one thing - json_encode I don't believe that relies on an
external library, it was always there when I installed php;
--
John
|
|
|
Re: json testing suggestions [message #184545 is a reply to message #184541] |
Wed, 08 January 2014 06:39 |
jnorth.au
Messages: 5 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:
> 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.
In php you should have the code looking like:
$myVar = json_encode( $arr );
echo $myVar;
?>
In firebug:
place a breakpoint at the first line of code in the callback function.
The returning data is actually the error message from php and can not processed correctly.
>
> 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
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
|
|
|
Re: json testing suggestions [message #184546 is a reply to message #184545] |
Wed, 08 January 2014 12:32 |
Beauregard T. Shagnas
Messages: 154 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
jnorth.au wrote:
>> ---
>> This email is free from viruses and malware because avast! Antivirus
>> protection is active.
>> http://www.avast.com
>
> ---
> This email is free from viruses and malware because avast! Antivirus
> protection is active.
> http://www.avast.com
jnorth.au, you and BobMCT both need to reconfigure your Avast programs to
remove the auto-insertion of the above spam messages. Thanks for your
consideration. It's caused by your recently updated version, and it also
has a malformed sig delimiter which causes it to be quoted by the unwary.
You do not need to scan outgoing or incoming email or news posts.
<http://thundercloud.net/infoave/tutorials/email-scanning/index.htm>
From the avastUI > Settings > Active Protection > Mail Shield > Settings
(wrench icon) > Behavior - General section > "Uncheck" Insert note into
clean message (outgoing).
--
-bts
-This space for rent, but the price is high
|
|
|
|
Re: json testing suggestions [message #184548 is a reply to message #184541] |
Wed, 08 January 2014 14:40 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma: 0
|
Senior Member |
|
|
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.
*Where* does it show “non response” (sic!)? *How?*
If in the Network tab, there are two possibilities:
A) You are not making an HTTP request with the correct URI.
B) You are not sending a non-empty HTTP response.
If A), you have to check the client-side script and Firebug's error console.
If B), you have to check the server-side script. Make sure that there are
no syntax errors or other PHP errors. The first lines of your PHP program
should be:
<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
ini_set() is necessary (except on a development system where the value
should be the default) unless you want/have to check the PHP log files
instead.
> 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.
*Which* errors?
> So my question is: can someone recommend some ways to properly debug
> the ajax/json process?
In addition to the above, there is the FirePHP add-on.
> 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.
They still are in the Network tab and the Console. <http://getfirebug.com/>
> BTW - having just recently upgraded from 10.04 to 13.10
Of what?
> I've run into other issues with compatibiity.
Useless information again.
<http://www.catb.org/~esr/faqs/smart-questions.html#beprecise>
And please get a real name.
PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(at)news(dot)demon(dot)co(dot)uk> (2004)
|
|
|
|
|
|
Re: json testing suggestions [message #184552 is a reply to message #184551] |
Thu, 09 January 2014 16:13 |
John Smith
Messages: 7 Registered: January 2014
Karma: 0
|
Junior Member |
|
|
On Thu, 09 Jan 2014 07:41:36 -0500, bill <william(at)TechServSys(dot)com>
wrote:
> On 1/8/2014 1:39 AM, jnorth(dot)au(at)example(dot)com wrote:
>
>> ?>
>>
>> In firebug:
>> place a breakpoint at the first line of code in the callback function.
>
> OT: in firebug, how does one set a breakpoint ?
>
> bill
you open the script in browser (start with right click - explore
element and from there go to the tab with the script, and set the
breakpoint.
Chrome is better in terms of debugging than Firefox with Firebug. Try
it.
For other questions please post in the right nntp group this is not
php
--
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!
|
|
|