I have the following WebMethod :-
[WebMethod(EnableSession = true)]
public static void OpenReport(string reportName)
{
Report report = reportsBll.GetReports().FirstOrDefault(x => reportQuestion != null && x.Id == reportQuestion.ReportId);
if (report != null) reportUrl = report.Url;
}
Now I wish to pass the report.Url to this Jquery Method :-
$('.ReportButton').click(function () {
var args = { reportName : '' };
$.ajax({
type: "POST",
url: "ReportsByQuestionsDetails.aspx/OpenReport",
data: JSON.stringify(args),
contentType: "application/json;charset=utf-8;",
success: function (data) {
alert('success');
document.location.href = reportUrl;
},
error: function () {
}
});
});
How can I pass the reportUrl from the WebMethod to the Jquery?
Thanks for your help and time
voidkeyword in your c# method means?datain your jQuery success function after changing your webmethod.console.log(data), not an alert.