用js取得返回的DataTable类型时,报错:A circular reference was detected while serializing an object of type 'System.Reflection.Module'
创建了一个WebService,返回一个DataTable,代码如下:
[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ToolboxItem(false)] [ScriptService] public class Service1 : System.Web.Services.WebService { [WebMethod] public DataTable GetData() { DataTable dt = new DataTable("testDT"); dt.Columns.Add(new DataColumn("col1", typeof(int))); dt.Rows.Add(new object[] { 1 }); return dt; } }
function btnClick(){ Service1.GetData(HandleStateChange,err);} function HandleStateChange(result){ alert(result); assa}function err(result){ alert("Error:" + result._message );}