mirror of
https://github.com/shouptech/tempgopher.git
synced 2026-02-03 16:49:42 +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);
|
var configdiv = $("<div></div>").addClass("five columns").append(configp);
|
||||||
rowdiv.append(configdiv);
|
rowdiv.append(configdiv);
|
||||||
|
|
||||||
var yesButton = $("<button></button>").attr("type", "submit").addClass("button button-primary").text("✔").css("margin-right", "5px");
|
var yesButton = $("<button></button>").addClass("button button-primary").text("✔").css("margin-right", "5px").click(function() {
|
||||||
var noButton = $("<button></button>").attr("id", "no" + configData.alias).addClass("button").text("✘");
|
$.ajax({
|
||||||
var buttonDiv = $("<div></div>").addClass("three columns").append(yesButton).append(noButton);
|
type: "POST",
|
||||||
rowdiv.append(buttonDiv);
|
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
|
var noButton = $("<button></button>").addClass("button").text("✘").click(function() {
|
||||||
$("#thermostats").append(titlediv);
|
|
||||||
$("#thermostats").append($("<form></form>").append(rowdiv));
|
|
||||||
|
|
||||||
// Re-engage reload, and re-render the thermostat on clear
|
|
||||||
$("#no" + configData.alias).click(function() {
|
|
||||||
window.setInterval(renderThermostats, 60000);
|
window.setInterval(renderThermostats, 60000);
|
||||||
renderThermostats();
|
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 = {
|
var jsconfig = {
|
||||||
baseurl: "http://foo.bar",
|
baseurl: "http://beerpi.home.shoup.io:8080",
|
||||||
fahrenheit: true
|
fahrenheit: true
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue