25.07.2024, 10:52
Working example using Fetch API:
Code:
async function send() {
var url = 'http://192.168.0.9/scada-remote?m=json&r=grp&fn=write&alias=0/0/1&value=1'
var user = 'remote'
var pass = 'Remote123'
var headers = new Headers()
headers.append('Authorization', 'Basic ' + btoa(`${user}:${pass}`))
var res = await fetch(url, { method: 'GET', headers: headers })
console.log(res)
}