Also uncomment the following code to run the code without error
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
https://www.c-sharpcorner.com/blogs/how-to-call-asp-net-web-service-using-jquery-ajax
or
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '../DashboardReports/DashboardReports.aspx/GetUnderInvStats',
data: JSON.stringify(reg),
dataType: "json",
success: function (data) {
var html = '<table id="tblStatsMonthlyProgressReport1" class="table-striped table-bordered table-responsive-sm text-center display nowrap table-sm" style="width: 100%">';
html += '<thead>';
html += '<tr class="th_PendUT table" >';
html += '<th scope="col" class="text-center">' + 'Sr.No.' + '</td>';
html += '<th scope="col">' + 'Zone' + '</td>';
html += '<th scope="col">' + 'Branch' + '</td>';
html += '<th scope="col" class="text-center">' + 'Cases' + '</td>';
html += '</tr>';
html += '</thead>';
$.each((data.d), function (key, value) {
html += '<tr>';
html += '<td>' + parseInt(key + 1) + '</td>';
html += '<td class="text-start">' + value.Zone + '</td>';
html += '<td class="text-start">' + value.Branch + '</td>';
html += '<td>' + value.Cases + '</td>';
html += '</tr>';
});
html += '</table>';
document.getElementById('divStatsMPR1Container').innerHTML = html;
var tbltitle = $("#ddlZone option:selected").html();
var tblSubtitle = "Monthly Performance report Stats for the period from " + ($('#txtdateFrom').val()) + ' to ' + ($('#txtdateTo').val());
$("[id$=divStatsMPR1Container]").show(500, BuildDataTableCommon($('#tblStatsMonthlyProgressReport1'), tbltitle, tblSubtitle));
$('#model').hide();
},
error: function (response) {
alert(response.responseText);
$('#model').hide();
}, complete: function (s, e) {
alert("it is done");
}
});
ref:- https://stackoverflow.com/questions/19411580/postback-during-an-ajax-call
No comments:
Post a Comment