incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Mueller (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-773) JSON.stringify error when making AJAX calls.
Date Mon, 04 Jun 2012 22:57:23 GMT

    [ https://issues.apache.org/jira/browse/CB-773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13288977#comment-13288977
] 

Patrick Mueller commented on CB-773:
------------------------------------

If this was stock Cordova 1.7.0, as stated, then it won't have any of the new console/logger
stuff in it.

You can see here, [the the 1.70. version of incubator-cordova-js/lib/ios/plugin/ios/console.js|https://github.com/apache/incubator-cordova-js/blob/1.7.0/lib/ios/plugin/ios/console.js#L23],
that if you pass a rando object to console.log (and the other preconditions are met), it will
attempt to JSON.stringify() it.  Garbage in, exception out.  :-)

I think the new logging/console code will need some checking along these lines as well, so
leaving this open for 1.8 (or later).
                
> JSON.stringify error when making AJAX calls.
> --------------------------------------------
>
>                 Key: CB-773
>                 URL: https://issues.apache.org/jira/browse/CB-773
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.7.0
>         Environment: Cordova 1.7.1
> Mac OSX 10.7
> iPhone simulator - iOS 5.1
> iPad 2 - iOS 5.1.1
> jQuery 1.7.1
>            Reporter: Aaron
>            Assignee: Patrick Mueller
>              Labels: ajax, jquery
>
> I'm attempting to load a JSON object via a $.ajax call and am getting a weird error.
It works fine on the iPad and iPhone simulators (iOS 5.1), but when testing on a real device
(iPad iOS 5.1.1) I receive the following error (courtesy of $(document).ajaxError). 
> 2012-05-13 20:21:12.955 Modeling[555:707] [INFO] TypeError: JSON.stringify cannot serialize
cyclic structures.
> The example json file I am loading can be found at:
> http://api.geonames.org/countryInfoJSON?formatted=true&lang=it&country=DE&username=demo&style=full
> There is no cycles or references, so the error received does not pertain to the source.
> Setup One (Successful):
> - iPhone Simulator - iOS 5.1
> - Cordova 1.7.0
> - jQuery 1.7.1 (& 1.7.2)
> Screenshot: http://i.imgur.com/MlFZ0.png
> The source was retrieved using $.ajax successfully (response "success").
> Setup One (Failure):
> - Physical iPad 2 - iOS 5.1.1
> - Cordova 1.7.0
> - jQuery 1.7.1 (& 1.7.2)
> Screenshot: http://i.imgur.com/e516V.png
> The url was NOT successfully processed.  An error of "JSON.stringify cannot serialize
cyclic structures." is given.
> Source code (example cordova index.html): https://gist.github.com/2698397
> As a side note, this was not an issue when using Cordova 1.5 or 1.6.1 (on iOS 5.1, NOT
5.1.1).  If you need any further details please let me know.
> This is a cross post from a jQuery bug report, as I am not sure if this is a Cordova
or jQuery issue.
> http://bugs.jquery.com/ticket/11762

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message