Skip to content

How to work with json recipe

philippeback edited this page May 22, 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 imbricated 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