Hello everyone, I am attempting to retrieve data from C# to JavaScript using ToolkitScriptManager. Here is my ASPX code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../assets/lib/jquery/jquery-2.0.3.js" type="text/javascript"></script>
<script>
$(window).load(function () {
alert(PageMethods.isConnected());
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager runat="Server"
EnablePageMethods="true"
EnablePartialRendering="true" />
<div>
</div>
</form>
</body>
</html>
And here is my code behind:
[ScriptMethod, WebMethod]
public static bool isConnected()
{
return true;
}
I'm not sure why the result keeps coming back as undefined. Apologies if this seems like a simple issue for you, but as someone new to ASP.NET, I find it challenging. Could someone please assist me in resolving this problem?