728x90

ajax이용해 reponse 값이 binary 이미지 가져오는 방법

 

$.ajax({
	cache : false,
	async : true,
	type : "get",
	dataType : 'json',
	url : "/approval/SelectApprFileList.do?doc_id=" + doc_id,
	success : function(res){
		console.log(res);
    	const buffer = res.response;
    	const blob = new Blob([buffer], { type: 'image/jpeg' });
    	const url = URL.createObjectURL(blob);
    	const img = document.createElement('img');
		img.src = url;
   		document.body.appendChild(img);
		}
	});

https://stackoverflow.com/questions/45450207/how-to-get-binary-image-correctly-using-redux-observable

 

How to GET binary image correctly using redux-observable?

I am trying to GET image using redux-observable. Based on Microsoft Graph API, it returns binary data of the requested photo. I succeed getting the image using Postman (it shows the image in the ...

stackoverflow.com

 

728x90

+ Recent posts