I am trying to load file in Svg-edit programmatically (not through standard "Open file button"). I added new function "Openclick", it should delete canvas and load saved .svg file (created previously in same editor) into canvas. Canvas is cleaned, but file is not loaded (file exist, data are in variable xml). Please can you help show correct way to load data into editor by this way ?
setTimeout(
function()
{
var url_adress="files/upload/"+file_name+".svg";
$.ajax({
url: url_adress,
type: 'GET',
dataType: 'text',
timeout: 100,
error: function(){
alert('Error loading XML document');
},
success: function(xml){
svgCanvas.clear(); // clear Canvas first
svgCanvas.setSvgString(xml); // load file into editor
}
});
}, 1200);`