I get the content of the HTML but not the data as a graph in the server side. FLOT = A Javascript charting library for jQuery
PIC of the graph, The area between the texts is place for the graph
HTML file:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot</title>
<link href="../examples.css" rel="stylesheet" type="text/css">
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="flot/jquery.js"></script>
<script language="javascript" type="text/javascript" src="flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="index.js"></script>
<script type="text/javascript">
$(function plot() {
var data = [];
$.plot("#placeholder", [ data ]);
// Add the Flot version string to the footer
$("#footer").prepend("Flot " + $.plot.version + " – ");
});
</script>
part of JS file:
//POST http://localhost:2456/temps
//html file read and sent with
app.post('/temps',function(req,resp){
resp.writeHead(200, { 'Content-Type': 'text/html' });
fs.readFile("flot.html", function (error, pgResp) {
if (error) {
resp.writeHead(404);
resp.write('Contents you are looking are Not Found');
} else {
resp.write(pgResp);
//resp.render(pgResp)
//resp.send(pgResp);
console.log("result of pgresp:", pgResp)
}
resp.end();
});