我正在尝试添加一个在ajax调用div中作为响应收到的SVG字符串。但它不起作用的是我的代码。
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"
});
}