I have the following code in jquery
$('#btnSubmit').click(function () {
$.ajax({
type: "POST",
url: "Appointment.aspx/saveAppointment",
data: "{firstname:'" + firstname + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(1);
// Do something interesting here.
}
});
});
I am calling this function in vb.net
<WebMethod()> _
Public Shared Function saveAppointment(ByVal firstname As String) As Boolean
Dim checkval = globalclass.firstname
Try
Catch ex As Exception
Throw ex
End Try
Return True
End Function
End Class
It seems to work without any parameters. There is no call if the parameters are provided. I also referred this but does seem to work
Calling an ASP.NET server side method via jQuery
Thanks!