问题描述
$("#Button3").click(function (e) {
e.preventDefault();
sendData3();
});
function sendData3() {
$.support.cors = true;
$.ajax({
type: "POST",
url: "http://localhost/imageRetrieve/Service1.asmx/GetImage",
data: "{ 'image_id' : 1 }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: Success3,
error: Error3
});
}
function Success3(data) {
// this fuction is called but i am not sure what to write here to retrieve the image
}
function Error3(request, status, error) {
alert("error3");
$("#label1").html(request.statusText);
}
以下是当我从浏览器访问" http://localhost/imageRetrieve/Service1.asmx/GetImage时得到的结果
< base64Binary> QzpcVXNlcnNcUHVibGljXFBpY3R1cmVzXFNhbXBsZSBQaWN0dXJlc1xDaHJ5c2FudGhlbXVtLmpwZw ==</base64Binary>
json的响应正文为:
{ d":[67,58,92,85,115,101,114,115,92,80,117,98,108,105,99,92,80,105,99,116,117,114,101,115,92,83,97,109,112,108,101,32,80,105,99,116,117,114,101,115,92,67,104,114,121,115,97,110,116,104,101,109,117,109,46,106,112,103]}
我不知道如何获取图像.
请帮助:(
Below is the result i get when i access ""http://localhost/imageRetrieve/Service1.asmx/GetImage" from browser
<base64Binary>QzpcVXNlcnNcUHVibGljXFBpY3R1cmVzXFNhbXBsZSBQaWN0dXJlc1xDaHJ5c2FudGhlbXVtLmpwZw==</base64Binary>
the response body from json is :
{"d":[67,58,92,85,115,101,114,115,92,80,117,98,108,105,99,92,80,105,99,116,117,114,101,115,92,83,97,109,112,108,101,32,80,105,99,116,117,114,101,115,92,67,104,114,121,115,97,110,116,104,101,109,117,109,46,106,112,103]}
I dont know how to get the image.
please help :(
推荐答案
这篇关于使用jquery.ajax()从客户端的Web服务获取图像并显示为aspx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!