Currently, I am trying to implement a JavaScript function for an HTML img click event on an aspx page. Additionally, there is a server method in the code behind page that I need to call from the JavaScript function without any parameters whenever the user clicks on the HTML img.
The C# Code Behind Method looks like this:
[WebMethod]
public void PopUpClick(object sender, EventArgs e)
{
//Something;
}
Here's the JavaScript Method:
$(document).ready(function () {
$('.clickme').click(function () {
PageMethods.PopUpClick();
});
});
I have also added the following code into the master page:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" EnablePageMethods="true" />
However, it seems like something isn't working properly. When I debugged the JavaScript function in Chrome, I encountered an error message stating "Uncaught Reference Error: PageMethods is not defined."