mirror of
https://github.com/shouptech/tempgopher.git
synced 2026-02-03 08:39:43 +00:00
Add POST that doesn't work
This commit is contained in:
parent
cfb14d490d
commit
b18a11ecb3
2 changed files with 29 additions and 11 deletions
|
|
@ -64,20 +64,38 @@ function renderThermostats() {
|
|||
var configdiv = $("<div></div>").addClass("five columns").append(configp);
|
||||
rowdiv.append(configdiv);
|
||||
|
||||
var yesButton = $("<button></button>").attr("type", "submit").addClass("button button-primary").text("✔").css("margin-right", "5px");
|
||||
var noButton = $("<button></button>").attr("id", "no" + configData.alias).addClass("button").text("✘");
|
||||
var buttonDiv = $("<div></div>").addClass("three columns").append(yesButton).append(noButton);
|
||||
rowdiv.append(buttonDiv);
|
||||
var yesButton = $("<button></button>").addClass("button button-primary").text("✔").css("margin-right", "5px").click(function() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: jsconfig.baseurl + "/api/config/sensors/",
|
||||
data: JSON.stringify([{
|
||||
"id": configData.id,
|
||||
"alias": configData.alias,
|
||||
"hightemp": htIn.val(),
|
||||
"lowtemp": ltIn.val(),
|
||||
"heatgpio": configData.heatgpio,
|
||||
"heatinvert": configData.heatInvert,
|
||||
"heatminutes": hmIn.val(),
|
||||
"coolgpio": configData.coolgpio,
|
||||
"coolinvert": configData.coolinvert,
|
||||
"coolminutes": cmIn.val(),
|
||||
"verbose": configData.verbose
|
||||
}])
|
||||
})
|
||||
});
|
||||
|
||||
// Add things back to the thermostat list
|
||||
$("#thermostats").append(titlediv);
|
||||
$("#thermostats").append($("<form></form>").append(rowdiv));
|
||||
|
||||
// Re-engage reload, and re-render the thermostat on clear
|
||||
$("#no" + configData.alias).click(function() {
|
||||
var noButton = $("<button></button>").addClass("button").text("✘").click(function() {
|
||||
window.setInterval(renderThermostats, 60000);
|
||||
renderThermostats();
|
||||
});
|
||||
|
||||
var buttonDiv = $("<div></div>").addClass("three columns").append(yesButton).append(noButton);
|
||||
rowdiv.append(buttonDiv);
|
||||
var confForm = $("<form></form>").append(rowdiv);
|
||||
|
||||
// Add things back to the thermostat list
|
||||
$("#thermostats").append(titlediv);
|
||||
$("#thermostats").append(confForm);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
var jsconfig = {
|
||||
baseurl: "http://foo.bar",
|
||||
baseurl: "http://beerpi.home.shoup.io:8080",
|
||||
fahrenheit: true
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue