Im trying to build an embedded web server with Nano WiReach SMT
So far i have wrote this code
<HTML>
<HEAD>
<SCRIPT LANGUAGE=JavaScript>
function swapImage() {
var val1 = "~Value1~"
val1=Number(val1);
intImage = val1;
switch (intImage) {
case 0:
IMG1.src = "off.jpg";
return(false);
case 1:
IMG1.src = "on.jpg";
return(false);
}
setTimeout("swapImage()",500)
}
swapImage()
</SCRIPT>
</HEAD>
<BODY>
<body onload="swapImage()">
<IMG id="IMG1" name="IMG1" src="on.jpg">
</BODY>
</HTML>
Through some AT+i commands to the Nano WiReach SMT i can change the ~Value1~ content, and by sending "0" and "1" i cant change the images. Now in order to change the image i have to always reload the page through the browser.. I wonder if there is anyway to do that automatic in some specified time period or even better when the Value1 changes without reloading the hole page.. Maybe put it on a div and reload just the div content but i dont know how.. One last thing..searching the web i found something similar with jquery..i cant use jquery cause the libs are very big for my uC..
Thank you
new Image()and preloading it in some other code somewhere?