How to read JSON with XMLHttpRequest

I’m trying to do an XMLHttpRequest to access a json from a URL.
I looked at the sample doc:

Didn’t get much out of it though… Here is my code:

    const Http = new XMLHttpRequest();
    const url ='';"GET", url);

Can anyone point me to a simple sample request or help me correct my code?

Did you try full example on this or just a code snipet if not try full example by copy paste

even when you get error where your code is failing

post log or something so others can better understood

return fetch(url)
            .then(function (response) {
                return response.json();
            .then(function (jsonResponse) {
                return downloadImage(selection, jsonResponse);

is this not sufficient for your requirement ?

1 Like

The URI scheme is the problem – XD only permits https requests.

1 Like

@kerrishotts - Thank you. I’m finding a lot of restrictions for coding in XD so far. The url I gave as an example above is a very specific sample of data that I use daily at work. It’s a shame that I can’t access it for prototyping.

I think it’ll work on Windows – the restriction here is because of Apple’s ATS, which XD enables by default.

You might be able to have a local proxy running that takes care of the security? Not sure. Would love to know more about your use case here – DM me if you want!