I have been working on a way to dynamically change the image src on a webpage. I'm using ASP.NET MVC3 and have an image point to a controller action. This works great for first load. Then I have an upload control and refresh the img src via jquery to load the new image. I call the same controller action as before in the first load.
This work in all browsers except for IE. In IE when I change the image and load via jQuery, I get prompted to download the file.
How can I refresh the image and have my required functionality work in IE?
Thanks!
~ Steve
View:
<img src="@Url.Action("ShowSavedImage", "DisplaySettings")" id="imgLogo" class="ContrainImage" />
Controller:
public ActionResult ShowCachedImage()
{
return File(user.TempLogoBytes, user.TempLogoContentType);
}
JavaScript:
$('#imgLogo').attr('src', '@Url.Content("DisplaySettings/ShowCachedImage/?v=")' + new Date().getTime());