In your code behind page, create a static Web method
[WebMethod]
public static string MyPageMethod(string myInputParameter)
{
}
In your aspx page, enable Page methods
<asp:scriptmanager id="MyScriptManager" runat="server" EnablePageMethods="true" />
In your javascript, call the page method (As you are using ASP.Net, you can take advantage of the PageMethods function. Pass in your input parameter(s) and then the function that should be executed when the method returns. Also, you can have a function for failures (after the success function)
var strID = "#" + ID;
PageMethods.MyPageMethod(strID, MyPageMethodFunctionResultSuccess);
function MyPageMethodFunctionResultSuccess(result)
{
}