Click here to Skip to main content
15,886,258 members
Articles / Web Development / ASP.NET

Consuming Webservice using JQuery ASP.NET Application

Rate me:
Please Sign up or sign in to vote.
4.22/5 (10 votes)
18 Mar 2010CPOL2 min read 71.8K   3K   35  
Consuming webservice using JQuery ASP.NET application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;

/// <summary>
/// Summary description for Common
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class Common : System.Web.Services.WebService
{

    ClientDataContext db = new ClientDataContext();

    public Common()
    {
    }

    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public Client InsertClient(string BizName)
    {
        Client objClient = new Client();
        objClient.BizName = BizName;
        InsertData(objClient);
        return objClient;
    }

    public void InsertData(Client objClient)
    {
        db.Clients.InsertOnSubmit(objClient);
        db.SubmitChanges();
    }

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Radicle software pvt ltd.
India India
Asp.Net Programmer

Comments and Discussions