JSON Server response
-
Hi!
Maybe this is a really stupid question but yet I'm asking it.I use callwithPOST to a server an expect an answer like "OK".
I get this though as a JSON object. How do i use this in the rest of the script?I would like it to work as a verification.
If response = "OK", Then something happens.I feel like this probably is a really easy thing to do, but if someone could help me I would be very grateful.
-
so (as you know) the callWithPOST format is:
Server.callWithPOST(String subURL, var parameters, var callback)
e.g.
Server.callWithPOST(tempURL, p, function(status, response){ });
response is a JSON object so you can reference any of the values in the response like any other JSON object
local myAnswer = response.<some value name>;
eg: assuming your JSON has a value called msg
Server.callWithPOST(tempURL, p, function(status, response){ reg myAnswer = response.msg; });
-
@lindon Thaaaaank you!!