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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Javascript - FormData()

Gmachado14
5-Regular Member

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
Gmachado14
5-Regular Member
(To:supandey)

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

View solution in original post

2 REPLIES 2
supandey
19-Tanzanite
(To:Gmachado14)

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.

Gmachado14
5-Regular Member
(To:supandey)

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

Top Tags