参考:https://blog.csdn.net/nmj2008/article/details/115004563
第一步:请求图片数据流
url = "http://localhost:6080/arcgis/rest/services/.....; $.ajax({ url:url, success:function(date){ console.log('suceess'); //var jsonObj = $.parseJSON(date); console.log(date); $("#img").attr("src", "data:image/png; base64," + date); }, error:function(){ console.log('error'); } }); }
GET data:image/png;base64,{{image}} net::ERR_INVALID_URL:https://stackoverflow.com/questions/34181961/get-dataimage-pngbase64-image-neterr-invalid-url
net::ERR_INVALID_URL Image:https://blog.csdn.net/qq_43029797/article/details/113738684
前端下载——处理后端返回的二进制文件(乱码):https://blog.csdn.net/heixiuheixiu666/article/details/105734283
在和后台交互的时候,如果后台返回给我们的是二进制流数据,我们就要在发送的时候加上{responseType:‘blob’}或者是{responseType: ‘arraybuffer’},这行代码,这样返回给我们的就不是乱码了