I'm trying to call a function in the codebehind of my .aspx page once the window is fully displayed. I tried using:
<script type="text/javascript">
$(document).ready(function () {
PageMethods.CheckForPageChange();
});
</script>
And it throws the following error:
0x800a1391 - JavaScript runtime error: '$' is undefined
I was able to get window.onload
to display an alert box, so I tried using it like this:
<script type="text/javascript">
window.onload = function () {
PageMethods.CheckForPageChange();
}
</script>
But it throws the error "PageMethods is undefined".
I have this inside of a "form" tag:
<asp:ScriptManager runat="server" ID="ScriptManager1" EnablePageMethods="true"></asp:ScriptManager>
And this in my codebehind:
[WebMethod]
public void CheckForPageChange()
{
throw new NotImplementedException();
}
Can someone please tell me what I am missing here? Any assistance is greatly appreciated!