I've been experimenting with the PageMethod feature in asp.net. To start, I added a Script Manager to my aspx page:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
Then, I created an onClick method in JavaScript:
function TestAJAX() {
PageMethods.TestA( onSucess, onError);
function onSucess(result) {
alert('Success!');
}
function onError(result) {
alert('Oops, something went wrong.');
}
}
In the code behind, I implemented the TryA method:
[WebMethod]
public static String TryA()
{
return "JSON CHECK";
}
Despite seeing that it enters the 'TryA' method in the debugger, I always receive the message 'something wrong'. What could be causing this issue? Thank you!