.net 后台传递数组给js
.net后代调用前台js函数,传递string参数比较简单,传递数组不太方便,可以先将数组拼接成string,再用xxString.split('x');来解析成数组
如果是double[]还需要在js中将string转换为double
//转换指标值 var qValuedata = qValue.split(','); for (var i = 0; i < qValuedata.length; i++) { qValuedata[i] = qValuedata[i] * 1; }
将double转换为string同理
qValuedata[i] = qValuedata[i] * ‘’;
js中数组的初始化与赋值,给数组的某一个值赋object对象
var dataLine = new Array(); for (var i = 0; i < qValuedata.length; i++) { dataLine[i] = { name: ‘’, value: ‘’, group: ‘’ }; }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
var dataLine = {};