Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
call web method using ajax call in webform c#
using System;
using System.Collections.Generic;
using System.Linq;
public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
public static void FunctionName()
//C# function code
catch (Exception e)
<script src="//"></script>
function functionName(){
type: "POST",
url: "Default.aspx/FunctionName",
data: '{parameterName: "' + parameterValue + '"',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
//success return
failure: function (response) {
//error return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment