Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. var init = function() {
  2. //.. do some overall initialization
  3. $.ajax({
  4. url: '/url/',
  5. method: 'GET',
  6. dataType: 'json',
  7. data: {}, //probably you have some parameters
  8. success: displaygraph,
  9. error: function() {alert('error getting data');}
  10. });
  11. }
  12.  
  13. var displaygraph = function(data) {
  14. $('#cy').cytoscape({
  15. style: // ...
  16.  
  17. elements: {
  18. nodes: data.nodes,
  19. edges: data.edges
  20. },
  21.  
  22. ready: function(){
  23. //...
  24. }
  25. });
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement