title: How can I return list object to ajax call back function from asp.net web form?
body: <p>I'm beginner in asp.net and write simple web application to show user any chart using highcharts tools, in highcharts need read data with ajax and for that purpose I write this code:<br/></p>
  
  <pre><code>function FetchData() {
              var pData = [];
              pData[0] = $("#ddlyear").val();
              var jsonData = JSON.stringify({ pData: pData });
              $.ajax({
                  type: "POST",
                  url: "CS.aspx/GetDataBehzad",
                  data: "",
                  contentType: "application/json; charset=utf-8",
                  dataType: "json",
                  success: OnSuccess_,
                  error: OnErrorCall_
              });
              function OnSuccess_(response) {
                  var aData = response.d;
                  alert(aData);
              }
              function OnErrorCall_(response) {
                  alert("Whoops something went wrong!");
              }
              e.preventDefault();
          }
  </code></pre>
  
  <p><br/>
  and in <code>CS.aspx</code> write this code:<br/></p>
  
  <pre><code>[System.Web.Services.WebMethod]
          public List&lt;int&gt; GetDataBehzad()
          {
  
              List&lt;int&gt; list = new List&lt;int&gt;();
              list.Add(10);
              list.Add(100);
              return list;
  
          }
  </code></pre>
  
  <p><br/>
  But when I run the application I get OnErrorCall function alert from ajax, how can I solve that? What is problem? thanks every one.</p>