Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
bfialkoff
Frequent Visitor

How to make a simple HTTP request from a visual?

I have been trying to integrate a request into one of my viusals and I'm having trouble getting it to work. I was hoping you might be able to help me out. I have a local server setup which I am requesting data from using a GET. I thought there might be a cross domain issue with the request, so I set up another local server and ran the same request from there and it worked. 

 

The body of the request is this: 

var xmlhttp = new XMLHttpRequest();
  xmlhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        console.log(JSON.parse(xmlhttp.responseText))

    }
  };

xmlhttp.open("GET", "http://localhost:8090/vis_data?name&value", true);
xmlhttp.send();

The visual is running on port 8080, the data lives on port 8090, and to test the domain issues I ran the same request from port 8070, and it worked.

Can anyone help?


Thanks!

1 ACCEPTED SOLUTION
bfialkoff
Frequent Visitor

It turns out that the visual is being hosted on powerbi and not on localhost:8080, and from their server I can't query localhost. Upon replacing the url in local host to https://jsonplaceholder.typicode.com/todos/1 I get the desired result. 

 

 

View solution in original post

1 REPLY 1
bfialkoff
Frequent Visitor

It turns out that the visual is being hosted on powerbi and not on localhost:8080, and from their server I can't query localhost. Upon replacing the url in local host to https://jsonplaceholder.typicode.com/todos/1 I get the desired result. 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.