Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 713561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:58:30+00:00 2026-05-14T04:58:30+00:00

what i mean by that is: i have a class called Customer: public class

  • 0

what i mean by that is:

i have a class called Customer:

public class Customer
{
    private string _firstName;
    private string _lastName;

    public string FirstName
    {
        get { return _firstName; }
        set { _firstName = value; } 
    }

    public string LastName
    {
        get { return _lastName; }
        set { _lastName = value; } 
    }
}

how do i instantitate the class “Customer” on the client code and add the data and post it?
(not sure if this is possible)

here is my client code:

 var customer = {
                  "firstName": escape($('#txtFirstName').val()),
                  "lastName": escape($('#txtLastName').val())
                };

var jsonText = JSON.stringify({ customer: customer });

$.ajax({
    type: "POST",
    url: "VisitorWS.asmx/AddCustomer",
    data: jsonText,
    //data: JSON.stringify(params),
    contentType: "application/json; charset=utf-8",
    ...........
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:58:31+00:00Added an answer on May 14, 2026 at 4:58 am

    Like Dave said you have to serialize the object between the two layers just as you do passing your object from your business layer to your database, etc. In the example you are showing above you are passing a JSON object to an old fashion ASMX web service. So make sure it can deserialize the JSON object to your C# class.

    I have a series of blog post on binding WCF with jQuery using JSON.

    http://professionalaspnet.com/archive/tags/WCF/default.aspx

    You can download my latest sample code:

    http://professionalaspnet.com/WCFJQuery.zip

    They recorded my Philly Code Camp presentation this weekend, you can watch that, along with 9 other talks here:

    http://codecamp.phillydotnet.org/2010-1/Lists/Sessions/MSDN.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple class called Job with a public ctor and public function
I have a class called Person with a property that specifies if there is
(C#, Rhino Mocks, MbUnit). I have a class called AccountManager that has a RegisterUser()
I only have experience with log4net however that does not mean that there are
What does it mean that a Transaction Log is Full? I have it the
If I have a STOMP/JSON AJAX app, does that mean that JSON is functioning
At work, development doesn't have revision control. By this I mean that we are
By that I mean, what do I need to do to have useful assertions
I have an application (winform exe) that I run several times. Does this mean
I want to have a generic object that implements an interface. I mean if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.