I have an asp.net webpage and a button. I call the ajax method in the button click event as follows
$("#btnTest").click(function () { $.ajax({ type: 'POST', url: 'test2.aspx', success: function (data) { alert( data); }, error: function (data) { alert("In error "); } }); });
In the successful notification of the part (data) Im gets the html code of the page test2.aspx (which I gave in the ajax url).
The code test2.aspx.cs is listed below
protected void Page_Load(object sender, EventArgs e) { jsonTest(); } public List<string> jsonTest() { List<string> list = new List<string>(); list.Add("aa"); list.Add("bb"); list.Add("cc"); return list; }
Why does this data in the βlistβ not come as response data in ajax?
Sudha source share