Hi guys!
I’ve searched this theme but didn’t find yet any documentation and I’m new in glide.
Could you please tell me how I could use Post method to send commands on my remote device?
I need to add a few variables on the basic level of the app and embed pretty simple scripts inside the buttons to POST commands.
Thank you for any support in advance!
<html>
<head>
</head>
<body>
<p>
<button type="submit" id="submit1">- 1 -</button>
<button type="submit" id="submit2">- 2 -</button>
<button type="submit" id="submit3">- 3 -</button>
<button type="submit" id="submit4">- 4 -</button>
</p>
<p>
<button type="submit" id="submit5">- 5 -</button>
<button type="submit" id="submit6">- 6 -</button>
<button type="submit" id="submit7">- 7 -</button>
<button type="submit" id="submit8">- 8 -</button>
<button type="submit" id="submit9">- 9 -</button>
</p>
<p>
<button type="submit" id="submit10">- 10 -</button>
<button type="submit" id="submit11">- 11 -</button>
<button type="submit" id="submit12">- 12 -</button>
<button type="submit" id="submit13">- 13 -</button>
<button type="submit" id="submit14">- 14 -</button>
</p>
<script>
var prefix='#>';
var suffix='$\n';
var sim='http://11.111.111.11:1111';
document.querySelector("#submit1").onclick = function(){let response = fetch(sim, {method: 'POST',body: prefix+'01'+suffix});}
document.querySelector("#submit2").onclick = function(){let response = fetch(sim, {method: 'POST',body: prefix+'02'+suffix});}
document.querySelector("#submit3").onclick = function(){let response = fetch(sim, {method: 'POST',body: prefix+'03'+suffix});}
document.querySelector("#submit4").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'04'+suffix
});
}
document.querySelector("#submit5").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'05'+suffix
});
}
document.querySelector("#submit6").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'06'+suffix
});
}
document.querySelector("#submit7").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'07'+suffix
});
}
document.querySelector("#submit8").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'08'+suffix
});
}
document.querySelector("#submit9").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'09'+suffix
});
}
document.querySelector("#submit10").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'10'+suffix
});
}
document.querySelector("#submit11").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'11'+suffix
});
}
document.querySelector("#submit12").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'12'+suffix
});
}
document.querySelector("#submit13").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'13'+suffix
});
}
document.querySelector("#submit14").onclick = function(){
let response = fetch(sim, {
method: 'POST',
body: prefix+'14'+suffix
});
}
</script>
</body>
</html>