# In template(not the dashboard one), payload not refresh

**URL:** <https://discourse.nodered.org/t/in-template-not-the-dashboard-one-payload-not-refresh/38767>\
**Category:** General\
**Created:** [8 January 2021 08:53 UTC](https://discourse.nodered.org/t/in-template-not-the-dashboard-one-payload-not-refresh/38767 "2021-01-08T08:53:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kihararuntu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kihararuntu/32/34974_2.png) [@kihararuntu](https://discourse.nodered.org/u/kihararuntu)\
**Post date:** [8 January 2021 08:53 UTC](https://discourse.nodered.org/t/in-template-not-the-dashboard-one-payload-not-refresh/38767/1 "2021-01-08T08:53:06Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/068b36c0a97c532fe989bf23f9a07ac5b36b2558.png)  
with a debug node, I can see the function node is outputting different values, but in the template's JS, every time it comes with same value.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e4e12a69e8808e65329c820a77b6746ab320bd68.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 January 2021 09:20 UTC](https://discourse.nodered.org/t/in-template-not-the-dashboard-one-payload-not-refresh/38767/2 "2021-01-08T09:20:43Z")

</div>

Hi @kihararuntu

The Template node generates text using the message it is given. It then passes that text on to the next node in the flow. That is all.

In your flow, you are using the Template node to generate some text that happens to be HTML/JavaScript that gets returned in response to an HTTP request to `/test`. When the Template node receives the message from the Function node it will generate that text and `{{payload.gasPct}}` will get replaced with the value of `msg.payload.gasPct` at that point in time.

Once that text is returned to the browser, there is no connection at all between what the browser does with that text and Node-RED. When the `setInterval` runs, the code inside it will have the value of `payload.gasPct` already hardcoded to that one value - nothing will change.

If you want a page to update with the latest value, then you can:

1. create a separate HTTP flow that just returns the data value, which you then poll using JavaScript on your page
2. create a WebSocket from your page back to another flow that can send the new value whenever it changes

The ability to just wire a flow into a page is one of the features provided by things like Node-RED Dashboard or UIBuilder. They do that work for you, to save you having to do the plumbing yourself. Of course they both come with other trade-offs in return for that convenience.

---

<div class="post-metadata">

**Author:** ![kihararuntu](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kihararuntu/32/34974_2.png) [@kihararuntu](https://discourse.nodered.org/u/kihararuntu)\
**Post date:** [8 January 2021 09:28 UTC](https://discourse.nodered.org/t/in-template-not-the-dashboard-one-payload-not-refresh/38767/3 "2021-01-08T09:28:10Z")

</div>

Thank you! I also felt like it only hardcodes once, but can't find a way to solve it, thank you for your advice

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 January 2021 09:28 UTC](https://discourse.nodered.org/t/in-template-not-the-dashboard-one-payload-not-refresh/38767/4 "2021-01-22T09:28:14Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
