cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript - FormData()

SOLVED
Highlighted
Level 7

Javascript - FormData()

hi,

I'm trying to send some values in a form to some server. Is this possible?

 

I have:

var xhttp = new XMLHttpRequest();
var form = new FormData();

form.append("temp_sensor", 1);
form.append("hum_sensor", 2);
xttp.open("POST", "127.0.0.1:5000/update_sensor", false);
xttp.send(form);

 

but I got this error:

Async Execution Failed in ServerCom_sendSensorInfo [Execution error in service script [sendSensorInfo] :: ReferenceError: "FormData" is not defined. (sendSensorInfo#1)]

 

Best Regards

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Javascript - FormData()

Hi, it's version 8. 

 

I already know that I'm doing one thing wrong. I was using localhost server but thingworx isn't in my machine. That's why the connection failed. Sorry!

 

I will fix this, then if I got any problems I comeback here. Sorry once again for taken your time

2 REPLIES

Re: Javascript - FormData()

Hi @Gmachado14 which ThingWorx version are you working with? Additionally, could you have the logging subsystem in the stack strace mode by navigating to System > Subsystems > LoggingSubsystem > Configuration and check the Enable Stack Tracing box to enable (server restart not needed).

 

Then reproduce this issue and please share with us the applicationlog, scriptlog & errorlog from ThingWorx.

Re: Javascript - FormData()

Hi, it's version 8. 

 

I already know that I'm doing one thing wrong. I was using localhost server but thingworx isn't in my machine. That's why the connection failed. Sorry!

 

I will fix this, then if I got any problems I comeback here. Sorry once again for taken your time