$('#va1').click(function (e) {
$.ajax({
url: '/open1',
data: 'va1',
type: 'POST',
success: function(response) {
if (response.text=="on") {$("#va1").css("background-image","url('/static/images/valve_h_blue.png')");}
console.log(response);
},
error: function(error) {
console.log(error);
}
});
@app.route('/open1', methods = ['POST'])
def open1():
return jsonify({
'text': 'on'
})