# Data from JS function

**URL:** <https://discourse.nodered.org/t/data-from-js-function/28738>\
**Category:** General\
**Created:** [22 June 2020 17:22 UTC](https://discourse.nodered.org/t/data-from-js-function/28738 "2020-06-22T17:22:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![grant1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grant1/32/49890_2.png) [@grant1](https://discourse.nodered.org/u/grant1)\
**Post date:** [22 June 2020 17:22 UTC](https://discourse.nodered.org/t/data-from-js-function/28738/1 "2020-06-22T17:22:11Z")

</div>

We have an industrial compressor in our plant that has a LAN port. I plugged it in and can view the operating data on a simple webpage via our local network. I inspected the page and found it uses JS functions. I am interested in obtaining the data from the first function highlighted below.

 ![AtlasCopco](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/8/080c7afebb069bbcf93e89284790d05d9908636b.png)

I pasted what I believed was the function into the HTTP GET box and unfortunately could not get any result. See below. I believe this should be a straightforward request, but I know almost nothing about executing a JS function in Node-RED. Maybe I should be using a Function node with the IP address specified somewhere? Any help is greatly appreciated.

 ![AtlasCopco2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/3/b35a67952886503758d372f0d3c74d4cef897da6.png)

---

<div class="post-metadata">

**Author:** ![grant1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/grant1/32/49890_2.png) [@grant1](https://discourse.nodered.org/u/grant1)\
**Post date:** [2 July 2020 21:35 UTC](https://discourse.nodered.org/t/data-from-js-function/28738/2 "2020-07-02T21:35:44Z")

</div>

Still trying to obtain the value from an HTML table. It appears the Cheerio node may be the best tool for this, but before I start down that path, maybe someone could look at what I am seeing below and chime in. The value that I am after is 54 C (and of course this changes dynamically, so if I check in a few minutes from now it will be different).

 ![Screenshot 2020-07-02 at 5.30.48 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/c/ac6baf75456792fd997054f91f1b98d3308ddd93.jpeg)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [2 July 2020 22:30 UTC](https://discourse.nodered.org/t/data-from-js-function/28738/3 "2020-07-02T22:30:26Z")

</div>

The problem you likely have is data is not present in the html - it will be dynamically added by the sites scripts.

You cannot simply http request to a script. I could explain but if have to explain quite a lot of concepts.

You have 2 possibilities I can see (there is a 3rd involving puppeteer or similar but it's a hack)

Best option...  
If the source data comes from a copco device, it likely supports [open protocol](https://flows.nodered.org/node/node-red-contrib-open-protocol) - you can get the values from the controller directly.

Alternatively, use the Devtools, look in the **network** tab see if you can determine if there is a http call to the backend where the values are retrieved.

---

<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:** [31 August 2020 22:31 UTC](https://discourse.nodered.org/t/data-from-js-function/28738/4 "2020-08-31T22:31:34Z")

</div>

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