title: WCF jQuery receiving list data from server
body: <p>I am trying to use jQuery + Ajax + WCF... Can you help me with it? If I use single data response in WCF it is ok, but when I try to send a list or massive as a response from WCF it looks wrong.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Activation;
  using System.ServiceModel.Web;
  using System.Text;
  
  namespace longpollingexample
  {
      [ServiceContract(SessionMode = SessionMode.NotAllowed)]
      [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
      [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.PerCall)]
      public class Service2
      {          
          static List&lt;int&gt; ff = new List&lt;int&gt;();
  
          [OperationContract]
          [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json)]
          public List&lt;int&gt; hi(int a, int f)
          {
              ff.Add(a*f);
              return ff;
          }
      }
  }
  </code></pre>
  
  <p>This is WCF service, we have only one function and try to get answer to list. List is static. How can I get any elements from this list? What I try to do...</p>
  
  <pre><code>  function hi2() {
          var t = 0;
          $.ajax({
              async: true,
              url: '/Service2.svc/hi',
              data: 'a= ' + $('#my1').val() + '&amp;f=' + $('#my2').val(),
              type: 'GET',
              dataType: 'json',
              success: function (data) {
                  var str='';
                  str += data[0].d;
                  $("#msgs").html(aa);
              },
              error: function () { alert('pop the champagne'); }
          });
      }  
  </code></pre>
  
  <p>Can I get <code>data[0].d</code> - the first element from my ff list? It is doesn't work (what's wrong? Thanks! Sorry for my english, i know it is really bad(</p>