I have the below Controller action
[HttpGet]
public ActionResult Image()
{
FileContentResult result;
var bmp = SomeBitmap;
using (var memStream = new System.IO.MemoryStream())
{
bmp.Save(memStream, System.Drawing.Imaging.ImageFormat.Jpeg);
result = File(memStream.GetBuffer(), "image/jpeg");
}
return result;
}
I have the following ajax call
function getImage() {
$.ajax({
url: '@Url.Action("Image", "Recordings")',
type: 'GET',
dataType: 'image/jpg',
cache: false,
success: function (data) {
Alert('never gets here');
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Status: " + textStatus); alert("Error: " + errorThrown);
}
});
}
Issue
Error returns parseError and 'No conversion from text to image/jpg'
Am i missing something here??