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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:33:40+00:00 2026-06-10T13:33:40+00:00

Hi; i have a question for calling wcf service. how to fill data array

  • 0

Hi; i have a question for calling wcf service. how to fill data array Key/Value pair? How to efficiently send collaction via jquery?



$('#btn').click(function () {
            var val = [];
            var names = [];
            $('#cblist :checkbox:checked').each(function (i) {
                val[i] = $(this).val();
                names[i] = $(this).attr('name');
            });

        });


<div id="cblist">"Dynamically filling"</div>
 <br />
     <input type="button" class="btn" value="AddParameter" id="btn" name="btnDelete" />

i dislike this below method(but below codes not working)Do you prefer this? if you prefer, how can i write correct coding?


for (var i in names,val) data.push({ name: names[i], value: val[i] });
    $.ajax({
       url: "echo/json/",
       data: data,
       dataType: "json",
       traditional: true,
       success: function(msg){alert(msg)}
    });

But i can not: i dislike call wcf service each array items. i will write 2 kind of wvf service:

First one is :


Service1.svc/AddParameter:

public void AddParameters(int id, params string[] names, params string[] values)
{
    //dosomething
}

Second one is :


Service2.svc/AddParameter:

public void AddParameters(int id, NameValueCollection  NameswithValues)
{
    //dosomething

}

Summary; i want to prepare data array for json format: data{ id: 1, name1:value1, name2,value2……….n}, an then call Service1 and Service2. which one is efficient method?

My main question is : how to write efficient json ajax method which ic calling Service1.svc and Service2.svc?

  • 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-06-10T13:33:41+00:00Added an answer on June 10, 2026 at 1:33 pm

    Try this instead

    var data;    
    $('#cblist :checkbox:checked').each(function (i) {
    
                       data[$(this).attr('name')] = $(this).val();
                    });
    

    Then just pass data in your ajax call.

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

Sidebar

Related Questions

I have a WCF service that needs to know the Principal of the calling
Question in title... In short - I have a WCF service exposing operations that
So, we have a service that takes list of updates via a WCF service,
I have a question which involves calling a function with 2 parameters of a
Java 6 API question. Does calling LockSupport.unpark(thread) have a happens-before relationship to the return
I have Question and QuestionTypes. In Question table there is a foreign key that
I have a WCF service that accepts an object as a parameter that has
I have a versioning issue with a WCF service contract in which one of
.NET 3.5, VS2008, WCF service using BasicHttpBinding I have a WCF service hosted in
Hello i have a question about servlet calling another servlet I have a main

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.