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 4273638
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:44:23+00:00 2026-05-21T07:44:23+00:00

in the current situation, when we post data from a webpage via the Jquery

  • 0

in the current situation, when we post data from a webpage via the Jquery Ajax post to a webservice, we build a Json string with two or three parameters and we have a webservice with a method that accepts that same (named) parameters.

But now i have an object in my javascript with 10 properties and i was wondering if i can post that entire object to my webservice.

I’ve tried posting the object and have an type ‘Object’ parameter in the webservice, but that didn’t work.

  • 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-21T07:44:24+00:00Added an answer on May 21, 2026 at 7:44 am

    Yes, this is possible. You need to create a class and make it serializable by using the DataContract attribute. You then use DataMember to mark the members of the class to be serialized. Something like this will do:

    [DataContract(Namespace = "http://www.yournamespace/")]
    public class MyObject
    {
        [DataMember]
        public long Id { get; set; }
    
        [DataMember]
        public String Name { get; set; }
    }
    

    Then in your WCF service:

        [OperationContract]
        [WebInvoke(Method = "POST", RequestFormat=WebMessageFormat.Json)]
        public bool HandleObject(MyObject myObject)
        {
    
        }
    

    In the client code, do something like this:

        $.ajax({ url: url,
            type: "POST",
            data: '{"myObject":' + json2string(myObject) + '}',
            contentType: "application/json",
            dataType: "json",
            success: function(data) {}
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This post from SqlBatman describes a situation similar to my current client and, in
Current situation: Ubuntu 8.04 server edition (live server) Postgresql 8.3.7 (from standard repositories) Postgis
The situation: I need to convert our current development environment from Windows XP 32-bit to
I'm using a Java program to POST some XML data from a remote client
Current Situation: Direct Binding I have an NSTableView which displays the data that comes
My current situation is: I have to read a file and put the contents
The current situation is that topics are sorted by 3 main categories. There is
In my current situation, it is not unusual for me to have several UNIX
let me explain my current situation i have a SharePoint site lets say it
I have a fairly standard inheritance situation in my current LINQ-to-SQL project. I have

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.