I make a request to my back-end which sends me an SVG image in the form of XML data. I want to render this image on my front-end, but document.getElementById("test").innerHTML = data;
results in [Object XMLDocument]
getting displayed inside my #test
div rather than an SVG image actually showing.
How can I get the actual SVG to render?
$.ajax({
type: 'get', //Request type
dataType: 'xml', //Data type - we will use JSON for almost everything
url: '/uploads/rects.svg', //The server endpoint we are connecting to
success: function(data) {
console.log("svgieig!!!", data);
document.getElementById("test").innerHTML = data;
})