把 js 数组 传到action
function modifyTravelMan(id){
var map = new Array();
map[0] = document.getElementById("credentialTypeId["+id+"]").value;
JourneyAction.modifyTravelMan(map,id,callTravelMan);
}
这是我的js,JourneyAction.modifyTravelMan(map,id,callTravelMan);
方法的第一个参数类型是数组,我要怎样把js的数组传到action中呢
求解、、
[解决办法]
楼主可以把数组平成字符串传到后台,然后后台split获取每个数组值。
var ids = ""; var mymessage = new Array(); for (i = 0; i < map.length; i++) { map[i]="'"+map[i]+"'"; ids += map[i] + ","; }