Custom Http Post Node

I want to create a node that has a dropdown of some data. I managed to create such dropdown and now i want to make a post request for each data i select in my Dropdown. How would i do that.

EDIT: Is this good ?

    RED.nodes.createNode(this,config); 
        this.options = config.options
        this.server = config.server;
        this.port = config.port;
        var node = this;
        node.on('input', function(msg) {
            let options = node.options
            const address = node.server;
            const port = node.port
            const ip = address + port;
            // const url = http://${ip}/${options.text}/value={{{msg.payload}}}
            const url = http://${ip}/${options.text}
            fetch(url, {
                method: 'POST',
                body: JSON.stringify({
                    title: options.text,
                    body: msg.payload
                }),
                headers: {
                    "Content-type": "application/json; charset= UTF-8"
                }
            })
            });

Options is my select tag server and port are ip of the server

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