In the cctv server I have in the index file this text which takes care of calling the GetIimages handler and put a new image in the html page:
Is it possible to add the image functionality to this index of a homecontrol app, which use a websocket :
B4X:
<script type="text/javascript">
function get_images(){
$.ajax({
url: "/GetImages",
success: function(result)
{
$("#images").html(result);},
});
}
$(document).ready(function(){
get_images();
setInterval(function(){get_images();}, 300);
});
Is it possible to add the image functionality to this index of a homecontrol app, which use a websocket :
B4X:
:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>EREZ home control</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<link rel="stylesheet"type="text/css" href="index.css" />
<script src="/b4j_ws.js"></script>
</head>
<body>
<h1><img src='kimel.jpg'/ width=100 height=100> EREZ home control<br/> </h1> <p id="plog"></p>
<div id="maindiv">
<br>Switch1 :
<input Type="radio" name="sw1" checked="True"> OFF <input Type="radio"id="sw1on" name="sw1" > ON <br>
<br>Switch2 :
<input Type="radio" name="sw2" checked="True"> OFF <input Type="radio"id="sw2on" name="sw2" > ON <br>
<br>Switch3 :
<input Type="radio" name="sw3" checked="True"> OFF <input Type="radio"id="sw3on" name="sw3" > ON <br>
<br>Switch4 :
<input Type="radio" name="sw4" checked="True"> OFF <input Type="radio"id="sw4on" name="sw4" > ON <br><br>
<buttonid="submit">Submit</button><br>
<p id="result"></p><br/>
</div>
<script>
//connect to the web socket when the pageis ready.
$( document ).ready(function() {
b4j_connect("/ws");});
</script>
</body>