Skip to content

How to work with json recipe

Oscar Nierstrasz edited this page Dec 5, 2013 · 2 revisions

In order to use JSON data for use by a library, you can do the following:

Class>>sample
    jQuery 
         getScript: '../vendor/jstree/dist/jstree.min.js'
         onSuccess: [
             jQuery 
                 getJSON: '../../jsonData.json'
                 onSuccess: [ :jsonData | 
                 '#treecontainer' asJQuery jstree: jsonData 
         ] ].

The code snippet above demonstrates two nested jQuery calls.

The first one loads an external javascript library, and once loaded, it proceeds to load a JSON document and pass the parameters loaded to the external library that has been loaded.

Clone this wiki locally