I am writing my own custom webpage and i’m reading item state with Openhab API which is very good but when i try to PUT a new temperature setpoint it does not work.
Here is my JavaScript jQuery code
$("#settemp").click(function() {
console.log("Gumb pritisnjen");
var request = $.ajax
({
type : "PUT",
url : "http://localhost:8080/rest/items/termostat1_zelena_temperatura/state",
data : '28',
headers : { "Content-Type": "text/plain" }
});
request.done( function(data)
{
console.log( "Success" );
});
request.fail( function(jqXHR, textStatus )
{
console.log( "Failure: " + textStatus );
});
});
In chrome console i get parsererror.