Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-773

JSON.stringify error when making AJAX calls.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.0
    • 1.8.0
    • cordova-ios
    • Cordova 1.7.1
      Mac OSX 10.7
      iPhone simulator - iOS 5.1
      iPad 2 - iOS 5.1.1
      jQuery 1.7.1

    Description

      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

      Attachments

        Activity

          People

            pmuellr Patrick Mueller
            bigred23z Aaron
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: