# Post Data into http

**URL:** <https://discourse.nodered.org/t/post-data-into-http/41015>\
**Category:** General\
**Created:** [15 February 2021 10:35 UTC](https://discourse.nodered.org/t/post-data-into-http/41015 "2021-02-15T10:35:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [15 February 2021 10:35 UTC](https://discourse.nodered.org/t/post-data-into-http/41015/1 "2021-02-15T10:35:06Z")

</div>

Hello,  
I cant find out how to post data into http site, that is created with template node.

I get a simple true value of my plc. Now I would like to post this true value into my html page instead of "test" in the

tag.

I guess the JSON node will not be enogh, I need a function node. But I dont know where to start.

 ![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/8/48d5ce03941dd25a38ffd8833eb4f673deef8564.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [15 February 2021 10:57 UTC](https://discourse.nodered.org/t/post-data-into-http/41015/2 "2021-02-15T10:57:47Z")

</div>

In template node replace text with `{{payload}}`

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [15 February 2021 11:02 UTC](https://discourse.nodered.org/t/post-data-into-http/41015/3 "2021-02-15T11:02:30Z")

</div>

Yes I did it so far, but now it says on the html site: [oject Object]

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [15 February 2021 11:07 UTC](https://discourse.nodered.org/t/post-data-into-http/41015/4 "2021-02-15T11:07:23Z")

</div>

Post the flow as can not see whats wrong with no info.  
Also a debug of the http in nodes output.

---

<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:** [15 February 2021 11:20 UTC](https://discourse.nodered.org/t/post-data-into-http/41015/5 "2021-02-15T11:20:36Z")

</div>

Hi @sfedo

At the moment you have two entirely separate flows

- one that gets the data from the serial port
- one that listens for requests to `/test` and returns some HTML content

If you want to include data from the serial port on the HTML page you need some way to link the two.

We have a recipe in the cookbook for exactly this scenario: [Include data captured in another flow : Node-RED](https://cookbook.nodered.org/http/include-data-from-another-flow)

It stores the data into flow context in one flow which allows the other flow to retrieve the most recent value.

---

<div class="post-metadata">

**Author:** ![sfedo](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sfedo](https://discourse.nodered.org/u/sfedo)\
**Post date:** [15 February 2021 11:27 UTC](https://discourse.nodered.org/t/post-data-into-http/41015/6 "2021-02-15T11:27:43Z")

</div>

@knolleary Wow great answer, thank you. It does exactly what I was looking for. Now I can continue to work with it.

To notice for myself: if I extract data from a different source, for example a plc, I need to "store" it first and then inject into html page right?

---

<div class="post-metadata">

**Author:** ![aderici](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/aderici/32/37279_2.png) [@aderici](https://discourse.nodered.org/u/aderici)\
**Post date:** [15 February 2021 14:25 UTC](https://discourse.nodered.org/t/post-data-into-http/41015/7 "2021-02-15T14:25:17Z")

</div>

Technically you can store it in memory and retrieve it when someone vists the web page.

Or, you can read the serial port on demand whenever web page is visited.

Both have different pros/cons

---

<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:** [1 March 2021 14:26 UTC](https://discourse.nodered.org/t/post-data-into-http/41015/8 "2021-03-01T14:26:02Z")

</div>

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