Javascript get api response

Okay, I do pretty decent with Javascript thanks to some great online support, but this one has got me flummoxed!

I am sending a request to a device using the manufacturers API. When I do the request on a Python script I get good data back and can parse the information I need. When I attempt to do the same thing in Javascript (taking load off a server I’m currently using to parse the data) Wireshark shows that the response is there, but I cannot get the data to show up in Javascript.

I’m attaching the request address and response via wireshark. Can someone please lead me in the right direction to get the response and parse the data??

I’m not attaching any code because every attempt I made came to nothing.

Request:
xxx.xxx.xxx.xxx/cgi-bin/aw_cam?cmd=QIF&res=1 (address redacted for security)

Reply via wireshark:
GET /cgi-bin/aw_cam?cmd=QIF&res=1 HTTP/1.1

HTTP/1.1 200 OK
Connection: close
Content-Type: text/plain
Set-Cookie: Session=0
Accept-Ranges: bytes
Cache-control: no-cache
Content-length: 6
Date: Wed, 07 Feb 2024 12:37:35 GMT

OIF:69

response as seen by browser:

OIF:69

I need to get the OIF:69 into a variable so I can parse the data for display.

Any assistance with this is appreciated. Code examples would be very welcome. I am beating my head against concrete on this and I know I’m missing something simple!

thanks for your help

Note, some elements of the request and reply are taken out because I couldn’t post them embedded into the message. What’s there should help you code experts out there though.

In JavaScript, use fetch or XMLHttpRequest to make the request. Then, extract the response data from the returned object. Example code: fetch(url).then(response => response.text()).then(data => console.log(data));