The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

456339 (2) [Avatar] Offline
Hi, Wonderful book! I'll review it on amazon soon!

I'm trying to use Google Charts and Chart.js for my own webpage: and I'm trying to employ your function from chapter2-hello-wot/client/ex-2.2-polling-temp-char

function doPoll() { //#F
function (result) {
addDataPoint(result); //#G
setTimeout(doPoll, 2000);

however, when I go to : I don't see where on that web page you are picking up the temperature value from?

My goal is to post from the ESP8266 (as I have done to google sheets with GScript, and my own webpage using a PhP script) but I don't see how the temperature is appearing anywhere on to be received by "chapter2-hello-wot/client/ex-2.2-polling-temp-char."

Please let me know where on the aforementioned web page the temperature is incoming from so that I can try my own charts with your temperature and then send my own data from the device-side to chart and graph.

thanks for any info
domguinard (71) [Avatar] Offline

First: very cool domain name! Congrats for grabbing!

Then, for your question. I'd suggest you have a second look at section 6.1.4 in the book: it will tell you all about content-negotiation, or the way to get different formats for a resource.


gets the temperature resource in JSON, when you go to with your browser you request it in HTML. To see the actual value in HTML try going to: which is the actual address of the temperature resource (/value is just a shortcut to get *only* the value).

Hope this helps, good luck with your site!
456339 (2) [Avatar] Offline
Hi Dominic,

thanks for your replie but I still dont get it.

On page view-source:

there is no actual numeric incoming value from the RPi anywhere on the page from which to take information from

then on page view-source:

the "recorded at" an sensor temp value are dynamically changing but I don't see anywhere in the code that is making this dynamically change. I'm confused where temp value is being recorded from and what code is making the second page dynamically update.

domguinard (71) [Avatar] Offline

The page: is actually generated on the server of the Pi and sent to your browser with the latest temperature value. If you want to build a page that fetches this you have to use Javascript and dynamically get the value from the API of the Pi.

For instance the following snippet gets the value and displays it in a popup:

function (result) { 

Hope that helps,