结果表明System.String [] [英] result shows System.String[]
本文介绍了结果表明System.String []的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的GetBusiness.aspx页我有创建一个测试列表
On my GetBusiness.aspx page i have create a test list
List<string> l = new List<string>();
l.Add("one");
l.Add("two");
l.Add("three");
l.Add("four");
l.Add("five");
// B.
string[] s = l.ToArray();
Response.Write(s);
我的第二个页面(默认aspx页面)我有一些jQuery加载此阵列和显示结果上编号:
No on my second page(default aspx page) I have some jQuery to load this array and show the results:
$.get('GetBusiness.aspx', function (returndata) {
// for each address in returndata
alert(returndata);
,但其结果是:System.String []
如果我重复,他遍历字符串System.String []
but the result is : System.String[] If I iterate , he iterate the string "System.String[]"
$.each(returndata, function (index, value) {
alert(index + ': ' + value);
};
我如何可以显示从字符串数组的结果?
How can I show the results from the string array?
推荐答案
修改的Response.Write(S)
来:
JavaScriptSerializer objSerializer = new JavaScriptSerializer();
Response.Write(objSerializer.Serialize(s));
的参考:的<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx\"相对=nofollow>的JavaScriptSerializer
这篇关于结果表明System.String []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文