In my javascript, I have:
var testdate = "{'TheNewDate' : '12/02/2011'}"; $("#mydiv").click(function () { $.ajax({ type: "POST", url: "../Pages/Appointments.aspx/GetAppointements", data: testdate, contentType: "application/json; charset=utf-8", dataType: "json", success: successFn, error: errorFn }); });
In my code I have
[WebMethod] public static string GetAppointements(string DateInput) { var t = DateInput;
However, when I click to start a call, I activate the error function. When I change the code behind the function to the public static string GetAppointement (), it works. But I assume that my goal is to pass the parameter to the code. What am I missing?
Thanks.
source share