I’m trying to connect my app to a REST web service. Below is my code. I receive a 500 error. I know that 500 error is a server error but if I use RestClient app, I receive a 201 response code and the result as I expect to.
Data sent using RestClient is exactly the same as “dato” variable.
Do you have an idea to solve it?
Thanks.
David.
My code:
Button1.onclick=function(){
URL=“http://dibse.ddns.net/NCWebAPI/api/CuentasAbiertas”;
encURL=encodeURI(URL);
dato='{"Cajero": 1,"Detalles": [{ "CodigoArticulo": "01000","Cantidad": "1.0"}]}';
Label1.value=dato;
req=Ajax(encURL,"POST",dato);
if (req.status==200 || req.status==201) {
Label2.value=req.responseText;
} else {
Label2.value="Error: "+req.status;
}
}