Skip to main content
1-Visitor
April 16, 2018
Solved

Javascript - FormData()

  • April 16, 2018
  • 1 reply
  • 4247 views

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

 

 

Best answer by Gmachado14

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

1 reply

5-Regular Member
April 20, 2018

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.

Gmachado141-VisitorAuthorAnswer
1-Visitor
April 20, 2018

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