Hi,
I did a ajax call using jquery to a handler. In the handler's response I write the context type and save a pdf file. Now in the jquery I have to open the pdf file. I used jquery file download plugin. But it doesn't work for me. Plz help me, to complete this task.
JQuery:
function CallHandler() {
$.ajax({
url: "iss_report.ashx",
contentType: "application/json; charset=utf-8",
success: OnComplete,
error: OnFail
});
return false;
}
function OnComplete(result) {
$.fileDownload(result);
}
function OnFail(result) {
alert('Request failed');
}
In handler:
public class iss_report : IHttpHandler {
public iss_report()
{
}
public void ProcessRequest (HttpContext context) {
Workbook wb= new Workbook();
context.Response.SetCookie(new HttpCookie("fileDownload", "true") { Path = "/" });
context.Response.ContentType = "application/pdf";
invoicebook.Save(context.Response, "mybook.pdf", ContentDisposition.Attachment, new PdfSaveOptions());
}
public bool IsReusable {
get {
return false;
}
}