How to place text data using d3.js
what am I doing wrong? x.innerHTML is undefined.
How can I put the text returned by d3.json into x? Thank.
<tr>
<td>1</td>
<td id = "val">0.087</td>
<td>0.23</td>
<td>0.3</td>
</tr>
</table>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js" charset="utf-8">
</script>
<script type="text/javascript">
var x = d3.select("#val");
setInterval(function() {
d3.json("./cgi-bin/script1.sh", function(error, text){
if (error) return console.warn(error);
console.debug(text.date);
x.innerHTML = text.date;
})
}, 1000);
</script>
</body>
+3
source to share