nnj 2010-03-17
代码如下:
public List<string> GetList() { List<string> list = new List<string>(); list.Add("aaaaaaaaaaaa"); list.Add("bbbbbbbbbbbb"); list.Add("cccccccccccc"); list.Add("dddddddddddd"); return list; }
代码如下:
<script type="text/javascript" language="javascript"> function BtnList_Click() { $.ajax({ url: "aa.asmx/GetList", data: {}, type: "post", success: function(data, status) { var str = ""; try { var obj = $(data.xml); var vals = obj.find("string"); $.each(vals, function(index, item) { str += $(item).text() + "<br/>"; }); $("#dd").html(str); } catch (ex) { alert(ex); } } }); } </script>