4 Replies Latest reply on Oct 28, 2014 7:01 AM by wunderblock

    Using Json in Edge Animate (Was: Json)

    wunderblock

      Hi,

      Since the new API intends not to rely on Jquery, what are the plans, if any, to handle json retrieval and parsing ? Adding back the jquery dependency for this sole purpose would make little sense. On the other hand, pure javascript is far less convenient in this special circumstance.

      Or am I missing something here ?

      cheers

        • 1. Re: Json
          vivekuma Adobe Employee

          You can use JSON.parse() and JSON.stringify() functions which are natively available in Javascript.

           

          You can use these function in native ajax calls from javascript for retrieving json like this:

          var xmlhttp = new XMLHttpRequest();

          var url = "sometext.txt";

           

          xmlhttp.onreadystatechange = function() {

              if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {

                  var myArr = JSON.parse(xmlhttp.responseText);

                  myFunction(myArr);

              }

          }

          xmlhttp.open("GET", url, true);

          xmlhttp.send();

           

          function myFunction(arr) {

              //use arr as json object here

          }

           

          hth,

          Vivekuma

          • 2. Re: Json
            wunderblock Level 1

            Yes I know that but that's still pure Javascript without the kind of flexibility provided by the jQuery.ajax() method. I'm still hoping for some sort of implementation of it in EA.

            • 3. Re: Re: Json
              joel_pau Level 5

              You can rebuild "previous" version loading jQuery as first external script, using the “Add Script” option within the library panel.

              ==> Adobe Edge Animate CC JavaScript API

              • 4. Re: Using Json in Edge Animate (Was: Json)
                wunderblock Level 1

                Yes  we can Joel ! But this sounds counterproductive to me.

                • "This dependency is removed in the latest Edge Animate Runtime, which means a smaller payload size and reduced number of downloads required for running your compositions."

                The question is about moving to the AdobeEdge.$ wrapper while keeping the good parts of jQuery and $.ajax() is one of them.