First to describe my scenario. On my page I have div with id showImage. Bellow that div there are few thumb. images which I want to display in larger in showImage div, without refresh page ofcourse. So here's what I have up to this moment. Generated html for every image is
<a href="/Property/GetImage/7">
<img id="7" class="details" width="100" height="100" src="/Property/GetImage/7" alt="">
</a>
I'm fetching image id and pass it to my controller which will return me an image (maybe I dont need this, cause I already have this image on same page, but I dont know how to use it) to continue, controller will return me an image which I need to show with larger dimensions in showImage div placeholder. Here's my code
function ShowLargeImage(imageId) {
$.ajax({
url: ('/Home/GetImage'),
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({ id: imageId }),
success: function (result) {
//need to pass result(image)to my div
},
});
}
function onPopUp() {
$(".details").click(function (event) {
var imageId = (this.id);
ShowLargeImage(imageId);
});
}
Question is: How can I call from js my showImage div, for example. showImage.Show(result); Is this possible?
<img src="..." />tag? or?