LabVIEW Web Development Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

WebService no connection from javascript

Solved!
Go to solution

I try to get the WebService example running:

 

https://forums.ni.com/ni/attachments/ni/7308/5/1/Add%20Two%20with%20Submit%20button.zip

 

Querying the vi via browser does work.

Quiztus2_0-1658395957408.png

using the submit button leads to connection error:

Quiztus2_1-1658396005984.png

 

 

I am not sure if this is related, but there is not WebService displayed in WIF configuration.

Quiztus2_2-1658396089469.png

 

 

Actor Framework
0 Kudos
Message 1 of 2
(1,455 Views)
Solution
Accepted by topic author Quiztus2

The mentioned example hardcodes port 8001 into the request. (addTwoWithSubmit.js)

 

function update()
{
URL = "http://127.0.0.1:8001/WebClient/AddTwo?first="
URL = URL + $('#firstNumber').val() + "&second=" + $('#secondNumber').val();

 

I replaced this code with:

 

URL = document.URL;
URL = URL.replace("addTwoWithSubmit.html", "") + "AddTwo";
URL = URL + "?first=" + $('#firstNumber').val() + "&second=" + $('#secondNumber').val();

 

now it works.

 

 

Actor Framework
0 Kudos
Message 2 of 2
(1,432 Views)