Ajax fetched JSON data,can't view on console

I am fetching data using $.ajax which comes in JSON format. But I can't view them on nodeRED nor on my console.
I am using url link from swagger to test.

            $.ajax({
                type:'GET',
                url:'http://localhost:8080/service/00000000-bc18-ac67-0238-57551bada1f2/definition',
                success: function (params) {
                    // console.log(params)
                }
            })

Is that running in the browser or the node-red server? If in the browser then it should appear in the browser developer console (I think).

it's in the node red server. Is there something like .html that would show me in the node?

Can you show us where you have put that code please.

I would like to see the result somewhere of what I am fetching...

oneditprepare: function(){
$.ajax({
type:'GET',
url:'http://localhost:8080/service/00000000-bc18-ac67-0238-57551bada1f2/definition',
success: function (params) {
// console.log(params)
}
})
}

You did not say this was in a custom node, and you have not asked in the Creating Nodes category. I will have to let someone else answer as I don't know how to do what you want.

I have moved it to the correct category for you.

1 Like

@Colin Oh! My bad. Thank you so much :smiley:

oneditprepare runs client side and only when you open the custom nodes property dialog.

Have you checked in browser console?

Does that Ajax even work/return something? A simple test is to open the browsers devtools console and paste it in.

Also check for activity in the network tab of devtools.

It seems I am getting results in my console. Thanks!

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