refer this code, check the inline comments
[System.Web.Services.WebMethod]
public static bool GetReport(int ID)
{
return true;
}
function GetData(id) {
var ID = parseInt(id);
var obj = { ID: ID };
var param = JSON.stringify(obj);
$.ajax({
url: '/ITS/Reports.aspx/GetReport',
method: 'post',
contentType: 'application/json; charset=utf-8',
data: param,
dataType: 'json',
async: true,
cache: false,
success: function (data) {
alert(data.d);
},
error: function (xhr, status, error) {
alert(xhr.responseText);
}
});
}
GetData(1);