b.writeTextFile Just not woking for me ???
If I run the BBB demo page script no problem but when I try my code I get (Uncaught TypeError: Cannot read property 'writeTextFile' of undefined)
Please what am I doing wrong?
Code: Select all
<html>
<body>
<head>
<title>Internet of Things with BeagleBoard.org</title>
<script src="jquery.js"></script>
<script src="bonescript.js"></script>
<!-- //<script src="processing.js"></script>-->
<script>
//var fs = require("fs");
var b = require('bonescript');
//var fs = require('fs');
function myFunction() {
var x = document.getElementById("myText").value;
document.getElementById("demo").innerHTML = x;
console.log(x); // the log prints out correctly
b.writeTextFile('/var/lib/cloud9/erw.txt',"header info"); // this is where i get my error
}
</script>
</head>
First Name: <input type="text" id="myText" value="Mickey">
<p>Click the button to display the value of the value attribute of the text field.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
</body>
</html>