title: How to call wcf method which has key/value params via jquery?
body: <p>
  Hi; i have a question for calling wcf service. how to fill data array Key/Value pair? How to efficiently send collaction via jquery?
  </p>
  
  <pre><code>
  
  $('#btn').click(function () {
              var val = [];
              var names = [];
              $('#cblist :checkbox:checked').each(function (i) {
                  val[i] = $(this).val();
                  names[i] = $(this).attr('name');
              });
  
          });
  
  
  &#60;div id="cblist"&#62;"Dynamically filling"&#60;/div&#62;
   &#60;br /&#62;
       &#60;input type="button" class="btn" value="AddParameter" id="btn" name="btnDelete" /&#62;
  
  </code></pre>
  
  <p><b>i dislike this below  method(but below codes not working)Do you prefer this? if you prefer, how can i write correct coding?
  </b></p>
  
  <pre><code>
  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)}
      });
  </code></pre>
  
  <p>But i can not: i dislike call wcf service each array items. i will write 2 kind of wvf service:</p>
  
  <p>First one is :</p>
  
  <pre><code>
  Service1.svc/AddParameter:
  
  public void AddParameters(int id, params string[] names, params string[] values)
  {
      //dosomething
  }
  </code></pre>
  
  <p>Second one is :</p>
  
  <pre><code>
  Service2.svc/AddParameter:
  
  public void AddParameters(int id, NameValueCollection  NameswithValues)
  {
      //dosomething
  
  }
  </code></pre>
  
  <p>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?</p>
  
  <p>My main question is : how to write efficient json ajax method which ic calling Service1.svc and Service2.svc? </p>