I have a page that is inside a master page which has a link button lnkfollow, when i click that button i want to call a method using ajax method. But the method is not invoking
this is the html portion of the content page - pagedetails.aspx
asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderLeft" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script>
$(document).ready(function () {
$(document.getElementById("<%=lnkFollow.ClientID%>")).click(function () {
$.ajax({
type: 'POST',
url: 'Pages/PageDetails.aspx/FollowUnfollow',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
Success: function () {
if ($(document.getElementById("<%=lnkFollow.ClientID%>")).text == "Follow me")
$(document.getElementById("<%=lnkFollow.ClientID%>")).text = "UnFollow";
else
$(document.getElementById("<%=lnkFollow.ClientID%>")).text = "Follow me";
},
});
});
});
</script>
code behind of the calling method this page is inside pages/pagedetails.aspx
[WebMethod]
public static void FollowUnfollow()
{
ClassifiedBL.Pages objpages = new ClassifiedBL.Pages();
//objpages.PagesId = pageid;
//objpages.memberid = memberid;
objpages.Sp_InsertFollowers();
}
control code inside content page
<asp:LinkButton ID='lnkFollow' class='btn btn-primary pull-right' runat='server' method="POST"><span class='fa fa-thumbs-o-up'>Follow me</span></asp:LinkButton>
But the method followunfollow inside pagedetails.aspx is not invoking. please find me a solution