Skip to content

Instantly share code, notes, and snippets.

@y-gagar1n
Created June 8, 2013 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save y-gagar1n/5734647 to your computer and use it in GitHub Desktop.
Save y-gagar1n/5734647 to your computer and use it in GitHub Desktop.
ASP.NET - Call method with jQuery AJAX
[WebMethod]
public static void SomeMethod(int paramA, string paramB)
{
...
}
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: window.location.href + "/SomeMethod",
data: "{ 'paramA': '" + valueA + "', 'paramB': '" + valueB + "' }",
dataType: 'json',
success: function (response) {
...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment