I am trying to publish a network with Cytoscape web (or cytoscape.js if possible.) Since my data is quiet huge i prefer to export it from Cytoscape desktop and grab it with ajax in my html. Before the last version of Cytoscape (v.3.1.0) i was able to export the network in .xml format using this:
$.ajax({
type: "GET",
url: "data.xml",
dataType: "xml",
error: function(){
alert("Error loading file");
},
success: function(data){
data = (new XMLSerializer()).serializeToString(data);
});
vis.draw({ network: data });
and it was working just fine.
When I try to do the same thing with .json (either converted from .xml or exported as .cyjs from Cytoscape desktop) it doesn't work. I used a similar code for this:
$.ajax({
type: "GET",
url: "data.json",
dataType: "json",
error: function(){
alert("Error loading file");
},
success: function(data){
}
});
var netwdata = data.elements[0];
vis.draw({ network: netwdata });
Although I do not get a loading error, the network is not plotted now. I have no experience with .json so I am sure I am missing something. Any help or comment is welcome.