Ajax Node, some more features?

Tags: #<Tag:0x00007f8d48b23c70>

It would be awesome if the ajax op would have a trigger to do the request on a triggerEvent. And maybe also to give the op an array of requests that it performs and returns an array of answers?

1 Like

array of requests is more complicated, don’t know how we could do that in a convinient/non confusing way really, also most of the time this can be fixed on the serverside.

refresh functionality is on my list!

2 Likes

The refresh is definitely a feature I would love to see on the ajax op !

@joscha95 @pandur I ended up writing a custom op to do some http request on trigger events, it could be usefull to someone waiting for the next release :slight_smile:

const dataIn = op.inString("route","");
let triggerIn = op.inTrigger("trigger");
let jsonOut = op.outObject("objectOut");

triggerIn.onTriggered = function  () {
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", dataIn.get(), false ); // false for synchronous request
    xmlHttp.send( null );
    jsonOut.set(JSON.parse(xmlHttp.responseText))
};