LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone know how to get data from a Labview web service with ajax or JSON?

Solved!
Go to solution

Hi

There is no poblem to run this web services with a labview vi or directly with the browser. The problem is the parserror I get when I use jquery(javascript).

Attached is a zip file with the project and the html files

Thanks...Eran

0 Kudos
Message 11 of 16
(1,301 Views)

Ahhh... so its specifically a jquery problem.

 

I did that once, but don't have the code with me. I'll look for it tonight. In the mean time do some checking with the jquery support forums.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 12 of 16
(1,299 Views)
Thanks
0 Kudos
Message 13 of 16
(1,287 Views)

Hi there, i think i've got exactly the same problem.

 

i've a vi running as webservice which should output just plain json, which is ok when i run it via browser.

when i use it in jquery - nothing happens, the response is empty although other non-labview json sources are working.

 

i can only guess what this really is but maybe someone has a clue, this really gives me headache!

 

thanks a lot

 

andy

0 Kudos
Message 14 of 16
(1,224 Views)
Solution
Accepted by topic author Eran1965

I found the cause for the problems

You can not add header("Access-Control-Allow-Origin: *") when you build the webservice (in the servere side)

 

You can get json with labview but you can not get JSON (from labview webservice) with javascript code

 

0 Kudos
Message 15 of 16
(1,199 Views)

it is def. the sop problem and after putting the whole stuff onto the NI webserver it worked. i'm currently trying to get jsonp to work - i found some NI document were they refer to jsonp and therefore i hope this will work out!

0 Kudos
Message 16 of 16
(1,193 Views)