I am trying to to use ajax
and/or JSON
for Web service restful which I have build and deployed with the Labview software.
However I get errors (parserror)
For example. I have build a web service from a Labview vi (z =x/y
localhost:8080/math/divide/5/20
will give {Z:"4.000000"}
)
I get results when I run the web service with the browers (Chrome, Explorer or from Android application I have wrote) but I am getting errors for the below examples.
Below are 2 examples: ajax
and getJSON
Does anyone know how to get data from the labview web service with ajax
or json
?
Thanks...Eran
Example 1
var url = "localhost:8080/math/math/5/20"; $.ajax({ dataType: "jsonp", ContentType: "application/json", headers: { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET" }, url: url + '&callback=?', }).done(function (data,status) { alert(status); }).fail(function (data,status) { alert(status); });
Example 2
$.getJSON("localhost:8080/math/divide/5/20&callback=?", function (data) { }).done(function (data,status) { alert(status); }).fail (function (data,status) { alert(status); });