what am I doing wrong? x.innerHTML is undefined as result.
How can I put the text, returned by d3.json in x? Thanks.
        <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>
                Your x is not a native dom element, it's a dom element wrapped by d3 and therefore does not possess the .innerHTML attribute.
Either use a d3 method to do it :
x.html(text.date)
Or get the original node and use innerHTML
x.node().innerHTML = text.date
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With