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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:16:42+00:00 2026-05-31T02:16:42+00:00

I am creating the following JSON object $(#btnSubmit).click(function () { var poll = {

  • 0

I am creating the following JSON object

 $("#btnSubmit").click(function () {
     var poll = { 'q': $('#txtQuestion').val(), 'a': [] };

     for (i = 1; i < counter; i++) {
         var a = $('#txtAnswer_' + i).val();
         poll.a.push(a);
     }


                  $.ajax({
                        type: 'POST',
                        url: "../_ws/Polls.asmx",
                        data: JSON.stringify(poll),
                        contentType: 'application/json; charset=utf-8',
                        dataType: 'json'

                  });



 });

basically, this retreives a question textbox’s value and answers textboxes (created on the fly) of a poll. The result is a ‘poll’ object.

I want to send this object to a webservice as seen above. No problems up until here. My question is how do I retreive this json object and process it in a function in my web service?

<WebMethod()> _
<ScriptMethod()>
Public Function AddPoll(**??? as ???**) As String

End Function

I would be grateful if anyone could help.

  • 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-31T02:16:43+00:00Added an answer on May 31, 2026 at 2:16 am

    If I understand correctly, poll will end up looking like this?

    { q: 'Question text', a: [ 'Answer 1', 'Answer 2', 'Answer 3' ] }
    

    If so, a simple method declaration you could use would be something like:

    Public Function AddPoll(q as String, a as List<string>)
    

    If you wanted something more precise, you could build up your own set of matching type:

    public class PollDTO {
      public string q { get; set; }
      public List<string> a { get; set; }
    }
    
    <WebMethod()>
    Public Function AddPoll(pollData as PollDTO)
    

    You’d need to also change your jQuery data parameter to group that data under the single variable also:

    data: JSON.stringify({ pollData: poll })
    

    More on that here: http://encosia.com/using-complex-types-to-make-calling-services-less-complex/

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

Sidebar

Related Questions

I'm creating a color object using the following code. curView.backgroundColor = [[UIColor alloc] initWithHue:229
I am creating several image dynamically using the following code: function refresh_gallery(galleryidentifier, albumid) {
I'm creating a JSON object like tags = {jon:[beef,pork],jane:[chicken,lamb]}; which was generated using php
I'm parsing a JSON response via $.ajax() and building a form from this object's
I'm creating the following div using javascript, task_id is an int and person_name is
I'm creating JPopUpMenu with following code: JPopupMenu popup1 = new JPopupMenu(); JPopupMenu popup2 =
The mailing list form I am creating has the following fields: first name, last
When creating a string using the following notation: NSString *foo = @Bar; Does one
I have the following code for creating tabs. It works at the end of
While creating the setup for VB.net application I am getting the following warning: Warning

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.