Last active
February 22, 2017 06:10
-
-
Save ivanitskiy/b9bd0476ee7ef5f4bb970553538037bc to your computer and use it in GitHub Desktop.
feed cytoscape graph from the ajax call.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var init = function() { | |
| //.. do some overall initialization | |
| $.ajax({ | |
| url: '/url/', | |
| method: 'GET', | |
| dataType: 'json', | |
| data: {}, //probably you have some parameters | |
| success: displaygraph, | |
| error: function() {alert('error getting data');} | |
| }); | |
| } | |
| var displaygraph = function(data) { | |
| $('#cy').cytoscape({ | |
| style: // ... | |
| elements: { | |
| nodes: data.nodes, | |
| edges: data.edges | |
| }, | |
| ready: function(){ | |
| //... | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment