Can't append JQuery fetch result in Dropdown Box in HTML nodeRED

I am fetching results using JQuery, I can see the results on the console but can't push it into the dropdown box.

   <script type="text/javascript">
    
        RED.nodes.registerType('uni-red',{
            category: 'Network',
            color: '#baff97',
            defaults: {
            name: {value:""},
            outputs: {value: 1}
            },
            inputs:1,
            outputs:1,
            icon: "Cute-Ball-Go-icon.png",
            label: function() {
                        return this.name || "uni-red";
                    },
            labelStyle: function() {
                    return this.name?"node_label_italic":"";
                },
            oneditprepare: function() {
                let url_base ='http://localhost:8080'
                const node = this    $.getJSON('http://localhost:8080/service/fa81c7a/TemperatureController/property/CurrentTemperature', 
         function(data){
                     const newOp = (`<option>${data}</option>`)
                      $("#node-input-operation").append(newOp)
        })
        },

    }
    
);
</script>

After this I have my normal HTML tags in place.

What is in data? I imagine it's an object since you are calling getJSON.

Example...

$("#node-input-operation").append(`<option value="${data.value}">${data.text}</option>`); 

So, on my console I am getting an UUID number from the .get function. Also Can I use node.send() somehow to show the result on nodeRED from script tag?

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