LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get data from server

Hello,

 

I am a beginner for LabVIEW nxg. I am getting data from the server, and pass my server URL to HTML get and want to plot the body into a graph. Moreover, data from the server are in array string so I converted into an array and try to plot it but still not working. So I already did the same application with LabVIEW but the same logic not working in LabVIEW nxg web app. Could you help me, how to do this or do you have any example which helps me to solve this prob ?.

0 Kudos
Message 1 of 9
(3,525 Views)

Post what you have...

0 Kudos
Message 2 of 9
(3,491 Views)

thanks for replying. You can see in the figure, this complete code runs on LabVIEW. But in LabVIEW nxg web app it showing error when I am trying to plot graph. I am reading data from the server. And trying to plot here. JSON format in the string so I converted into an array. But here it is showing that this string to array function is not available. Even I can not print the body or header of url. 

0 Kudos
Message 3 of 9
(3,483 Views)

@022004009 wrote:

But here it is showing that this string to array function is not available. 


If that is the problem, convert the string manually. In a while loop, get a number (scan from string) until the output of scan from string is empty.

0 Kudos
Message 4 of 9
(3,474 Views)

Thanks but the problem is that output form body and header are empty and showing nothing. So, first if there is anything then I can convert. So do you know is it the right method to get data from the server using HTML function or I am missing any other function to read data from the server ?.  

0 Kudos
Message 5 of 9
(3,365 Views)

I'm not that familiar with NXG.

 

The VI sure looks like it should get HTML from a URL.

 

I'd check if the VI returns an error. If so, it should be helpful.

 

0 Kudos
Message 6 of 9
(3,359 Views)

this error I am getting

JavaScript message in Main.html at line 0: XMLHttpRequest cannot load http://127.0.0.1:8001/Web_Server/ParametricCurve. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:52131' is therefore not allowed access.

 

0 Kudos
Message 7 of 9
(3,354 Views)

@022004009 wrote:

this error I am getting

JavaScript message in Main.html at line 0: XMLHttpRequest cannot load http://127.0.0.1:8001/Web_Server/ParametricCurve. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:52131' is therefore not allowed access.

 


The reason is explained here:

why-does-my-javascript-code-get-a-no-access-control-allow-origin-header-is-pr 

 

Next step would be to find a solution... I'm not sure if I can help with that.

0 Kudos
Message 8 of 9
(3,345 Views)

Thank a lot. I will try this solution. 

0 Kudos
Message 9 of 9
(3,336 Views)