I'm trying to add a SVG string received as response in ajax call to a div. But its not working here is my code.
main.js
function update() {
var axis1Value = $('#axis1 :selected').text().trim();
var axis2Value = $('#axis2 :selected').text().trim();
var shapeBy = $('#shape :selected').text().trim();
var colorBy = $('#colorField').val();
var myData = '{ "column_names":["'+axis1Value+'","'+axis2Value+'"], "color_by":"'+colorBy+'","shape_by":"'+shapeBy+'"}';
$.ajax({
type: 'POST',
url: 'http://localhost:9080/sample-demo/api/samplechart/create',
data: myData,
success: function(result) {
console.log(result);
var el = $('#mychart');
el.remove();
el.append(result);
},
contentType: "application/json",
dataType: "html"
});
}