Hello,
I tried to make an AJAX / http request using the following lines in a script node and got the associated errors in the devtools console:
JS{{
var xhttp = new XMLHttpRequest();
}}
widget.js:629 script_1.script: JS{{}} error:
TypeError: XMLHttpRequest is not a constructor at line 2
JS{{
var xhttp = require("xmlhttprequest").XMLHttpRequest;
}}
widget.js:629 script_1.script: JS{{}} error:
ReferenceError: require is not defined at line 2
Is it possible ?
Thank you
Ajax is not allowed in this context, it’s not possible.
Ah dommage Is there any other way to send some hardcoded HTTP GET request after clicking a button? I would like to do something like this : http://127.0.0.1:9090/requests/status.xml?command=pl_play
(https://wiki.videolan.org/VLC_HTTP_requests/)
With an iframe it’s possible to make it work, try the attached session file : iframe_get.json (1.7 KB)
XMLHttpRequest are disabled in scripts for security reasons, but allowing them for simple local-only requests could be nice. I’ll dig the possibility of adding a http_get
function to the script’s context.
1 Like
This is great. Thanks a lot for the session file Jean-Emmanuel !
httpGet
is available in scripts as of v0.48.2 ! (see docs)
1 Like
Damn you’re fast ! Thank you ++ !