title: Ajax response data in .net
body: <p>I have a asp .net web page and a button in it. I'm calling an ajax method in the button click event as follows</p>
  
  <pre><code> $("#btnTest").click(function () {
                   $.ajax({
                       type: 'POST',
                       url: 'test2.aspx',
                       success: function (data) {
                           alert( data);
  
                       },
                       error: function (data) {
                           alert("In error  ");
  
                       }
                   });
               });
  </code></pre>
  
  <p>In success part alert( data) Im getting the html code of the page test2.aspx (which one I have given in ajax url).</p>
  
  <p>In test2.aspx.cs code is given as below</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          jsonTest();
      }
  
      public List&lt;string&gt; jsonTest()
      {
          List&lt;string&gt; list = new List&lt;string&gt;();
          list.Add("aa");
          list.Add("bb");
          list.Add("cc");
          return list;        
      }
  </code></pre>
  
  <p>Why this data in 'list' is not coming as response data in ajax?</p>