Webcam auto refresh with jQuery

Webcam auto refresh with jQuery

The website is made with CMS Drupal, so every jQuery code is like this:

(function ($) {

//code here

}(jQuery));








as mentioned on the Drupal documentation. I have other jQuery codes and they are working perfectly.

The idea is to put webcam that will auto refresh in couple of seconds. The source for the webcam is picture of webcam that is refreshing and it's like this:



<body onload="JavaScript:timedRefresh(30000);">
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
setTimeout("location.reload(true);",timeoutPeriod);
}
// -->
</script>



"


time=1364566215" is changing in about 20 seconds, so I want to put this webcam in my website.

If I create a page with html:



<img id="live_cam" src="http://www.website.com/images/livecam/livecam2-bg.jpg?time=1364566398">

I can see the picture, but after couple of seconds it's gone.