AjaxPro.2.dll 返回数组
(1)CS传数组 js文件接收
CS文件代码:
[AjaxPro.AjaxMethod]
public String[] Waring(){
String[] Waring_info= new String[3];
Waring_info[0]="aa";
Waring_info[1]="bb";
Waring_info[2]="cc";
return Waring_info;
}
js代码:
function waringAjax(){ var str_Waringinfo= MySpaceAjax.Waring().value; var str_Waring_count=str_Waringinfo[0]; var str_Waring_value=str_Waringinfo[1]; var str_Waring_voice=str_Waringinfo[2]; }
(2)也可以 js传数组,cs文件接收处理
JS代码:
function waringAjax(){ var p = MySpaceAjax.GetStringList([1,2,3],[4,5,6]).value; for(i=0;i<p.length;i++) { alert(p[i]); } }
AjaxPro.AjaxMethod] public int[] GetStringList(int[] alist,int[] blist) { int[] newresult = new int[3]; for(int i=0;i<alist.Length;i++) { newresult[i] = alist[i]+blist[i]; } return newresult; }