Answer the question
In order to leave comments, you need to log in
How to render a resource using js?
js experts, please tell me. How to display an image on a web page, the path to which I receive from the REST FUL service.
More:
There is a WCF Rest Ful service that returns a picture.
[ServiceContract]
public interface IService
{
[OperationContract()]
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "GetPic/{value}", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
string GetPic(string value);
}
"<img src="http://voucik.com/Immages/038123ae-f7fe-494b-8f82-1ba06e5d5b4d/8ef1ada2-5865-4dab-949e-4859504fd146/1.png" width=468 height=60 border=0>"
<body>
<h2>Show</h2>
<script type="text/javascript" src="http://voucik.com/Service.svc/GetPic/8EF1ADA2-5865-4DAB-949E-4859504FD146">
</script>
</body>
Answer the question
In order to leave comments, you need to log in
You need to make an AJAX request and put the resulting response on the page.
Example using jQuery:
<script src="http://yandex.st/jquery/2.0.3/jquery.min.js"></script>
<script>
$(function(){
$.get('http://voucik.com/Immages/038123ae-f7fe-494b-8f82-1ba06e5d5b4d/8ef1ada2-5865-4dab-949e-4859504fd146/1.png', {}, function(response){
$('body').append(response);
});
});
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question