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 () {
$.ajax(
{
type: 'GET',
data: { 'selectedReport': selectedReport },
datatype: "json",
url: "/StoreProfile/PrintReports",
success: function (data) {
var json = data;
console.log(json);
//$('#printReports').html('');
//$('#_genericReport').html(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.