我需要以以下格式向highChart传递值:
data: [
['Firefox', 45.0],
['IE', 26.8],
]
我有一个类似于以下的表格中的值
<table>
<tr>
<th colspan="2">
<div align="left">Expenditure in, or on behalf of, Scotland </div>
</th>
</tr>
<tr class="row">
<td>Public sector debt interest</td>
<td><?php echo $x ?>></td>
</tr>
<tr class="row">
<td>Public sector debt interest</td>
<td><?php echo $x ?>></td>
</tr>
</table>
我试图从类似这样的表中创建数组,但是它没有起作用。
$('.row').each(function (i) {
var data = [];
$(this).find('td').each(function (j, v) {
if (j == 0)
var label = $(this).html();
else {
var val = $(this).html();
data[label] = val;
}
});
});
请问有人能帮我找出我的错误吗?
先行致谢。
table
标签在script
标签内部 - Rory McCrossan