Skip to content

Instantly share code, notes, and snippets.

@ivanitskiy
Last active February 22, 2017 06:10
Show Gist options
  • Save ivanitskiy/b9bd0476ee7ef5f4bb970553538037bc to your computer and use it in GitHub Desktop.
Save ivanitskiy/b9bd0476ee7ef5f4bb970553538037bc to your computer and use it in GitHub Desktop.
feed cytoscape graph from the ajax call.
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