我有一个控制器,它返回一个byte [],如下所示:
public JsonResult GeneratePDF(string orderQuoteId)
{
byte[] pdfData = ServiceCall();
return Json(pdfData);
}
ajax调用如下,但失败了:
$.ajax({
url: '@Url.Action("GeneratePDF", "AccountDetail")',
type: 'GET',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
data: { 'orderQuoteId': orderQuoteId },
success: function (result) {
alert('success');
},
error: function () {
alert('Error occured while creating PDF');
}
})