Generating PDF report via AJAX call MVC

Posted by Self-Innovator under ASP.NET AJAX on 5/27/2016 | Points: 10 | Views : 1127 | Status : [Member] | Replies : 1
Hi all,

I wanted to Generate a PDF report using Ajax call, I can able to generate it successfully with below statement but how can ii achieve this using AJAX call

 $('#printReports').click(function () {
window.location.href = "/StoreProfile/PrintReports?selectedReport=" + $("#bindReports").val() + "&storeNumber=" + '@Model.StoreProfileAssociation.StoreNumber';

Instead of above statement i want it to generate PDF using AJAX, the below code i have tried but seems does not working, kindly help me with some good suggestions

$('#printReports').click(function () {                 
type: 'GET',
data: { 'selectedReport': selectedReport },
datatype: "json",
url: "/StoreProfile/PrintReports",
success: function (data) {
var json = data;
window.location.href = "/StoreProfile/PrintReports";
error: function (result) {
showAlert("Error", 'Failed to load the result');

I tried in the above method but didn't worked.

Join Hands Change lives
Thanks & Regards
Straight Edge Society


Posted by: Bhuvanesh6 on: 7/16/2016 [Member] Starter | Points: 25

Have you tried using some of the PDF javascript libraries to render PDF directly from javascript without plugins, like mozilla pdf.js or jspdf.

Please reply with error what you face executing above code.


Self-Innovator, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response