I want to check if I have a connection to my webcam in the same network. At the moment I include it with this js code:
document.write('<IMG id="camera" width="' + view_w + '" height="' + view_h + '" SRC="http://192.168.1.195/GetData.cgi?CH=1"');
It works well! Now I turned off the router. After a few second is the stream away. Now I want to check it every 500ms. When I use this code:
$(document).ready(function(){
$('#camera').load(function(){
alert("loaded");
});
$('#camera').error(function(){
alert("not loaded");
});
});
It works well, and I get an alert window on the screen (both events works!).
Now I placed this into a intervall
, but it don't work.
$(document).ready(function(){
setInterval(function(){
$('#camera').load(function(){
alert("loaded");
});
$('#camera').error(function(){
alert("not loaded");
});
}, 500);
});
What is the problem with the last code snippet?