[英]Access response from jQuery.get() or jQuery.ajax()
我使用$.get()
从文件获得响应
$.get('filename.svg', function (response) {
console.log(response);
return response;
});
当我记录响应时,我看到这样的内容
#document
<svg ...>
<g>....</g>
</svg>
我想问一下如何访问#document ? 属性。 并在没有#document
情况下打印<svg></svg>
标签
为了弄清楚我到底需要什么。 我需要使用getBBox()
计算SVG大小
您可以使用$.ajax()
并提供dataType
作为text
$(function(){
$.ajax({
url: 'filename.svg',
dataType: 'text'
}).then(function (response) {
console.log(response);
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.