[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService] //[ScriptService] public class _Default : System.Web.Services.WebService { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString); SqlConnection conRecipes = new SqlConnection(ConfigurationManager.ConnectionStrings["constrRecipes"].ConnectionString); public _Default () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string AddNominations() { return "Nomination Added Successfully"; }
function CallService() { $.ajax({ type: "POST", url: "_Default.asmx/AddNominations", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: Success, error: Error }); } function Success(data, status) { $("#lblResult").removeClass("loading"); $("#lblResult").html(data.d); } function Error(request, status, error) { $("#lblResult").removeClass("loading"); $("#lblResult").html(request.statusText); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)