如果webservice返回数据集DataSet,客户端java脚本如何取得数据呢?
可以通过在webservice中把dataset转换为数组。如employee[ ]
然后在客户端脚本,声明多个数组变量.
在客户端脚本的webservice回调函数中,遍历回调参数值。
然后利用result[i].x的形式给声明的变量数组赋值.
function showdepartments1(result) {
?????? if (result && result.length != 0) {
??????????? var points = new Array();
??????????? var names = new Array();
??????????? var ids = new Array();
??????????? opers = new Array();
??????????? addrs = new Array();
??????????? teles = new Array();
??????????? for (var i = 0; i < result.length - 1; i ++) {
??????????????? if (!(result[i].x == 0 && result[i].y == 0)) {
??????????????????? points.push(new LTPoint(result[i].x,result[i].y));
??????????????????? names.push(result[i].depname);
??????????????????? ids.push(result[i].id);
??????????????????? opers.push(result[i].operation);
??????????????????? addrs.push(result[i].address);
??????????????????? teles.push(result[i].telephone);
??????????????? }
??????????? }
??????????? show(points,names,ids);
??????? } else {
??????????? map=new LTMaps("myMap");
??????????? map.cityNameAndZoom( "xian",13 );
??????? }?}