AJAX image reload

I am trying to get a image to automatically refresh using AjaxWDwx.js

I have done this:

var lightningmap ='location to image';
"<img src=\"" + lightningmap + "\" " +
"alt=\"Lightning Map\"" +
"title=\"lightningmap\" />" );

I specified the span id the image and it doesnt refresh?

Any ideas?

So no one knows?

How often is your lightning map updated? If it’s longer than the AJAX update cycle, then it’s probably best to not add the refresh into your ajaxWDwx.js script.

Something like this on the page can refresh the image at a frequency more like that which you may be uploading the lightning map

<img src="lightningmap.jpg" id="myPull" alt="Lightning Map" width="320" height="240" />

<noscript><p><strong>Note:</strong> You need to enable JavaScript to view the images automatically refreshed.</p>
<script type="text/javascript">
var reloadSecs = 60;  // reload every 60 seconds
function reloadImage() {
    var now = new Date();
    if (document.images) {
        document.images.myPull.src = 'lightningmap.jpg?' + now.getTime();


Hope this helps…

Best regards,

Thanks Ken,
Data and Map will update once per min.

If it could be integrated into Ajaxwdwx.js, it would be better (less overhead)

Since the ajaxWDwx.js script actually runs the ajaxLoader() function at a different interval that what you want to refresh the data/map, there’s not a measurable performance penalty with running the map refresh with a bit of inline JavaScript code.

Ok cool as, I will leave it then :slight_smile:

I have tried to make a timeout with this script but it wont work.
Ken would you know how to implement it?

I was wondering if this js code could be used to update the EC national radar image on the Canadian ajax template so the whole page wouldn’t have to be reloaded to refresh the image? I tried the code, but then realized that if the ec-radar.php script isn’t run, the -0.png image isn’t refreshed from the EC site. #-o Can the “id=” be moved up into the

for the top of the screen, or just before the “include_once(“ec-radar.php”);” call, or am I barking up the wrong tree? :? I just looked again, the
would cause the whole dashboard to refresh! #-o guess that won’t do! 8O


Is ec-radar.php a graphic script?
If it sends a header then you can just call up the image using a blah

The only problem I have with this script is that if you have a page parker the person will chew up your bandwidth.
Thats why I tried to setup a timeout like the AJAX scripts do :wink: but failed, LOL


No the ec-radar.php “harvests” 8 .png images from the EC site to give a jscript animation, the dashboard uses the “youngest” image of the set.

Did you look at the way the ajax does the maxupdates? There should be a way to add an “if-then” check on a counter variable that gets incremented by one every time the image gets refreshed, when it exceeds the max value, drop out of the loop until the page gets reloaded and the variable gets reset. This stuff is reminding me of my BBS days writing code using a specialized version of compiled BASIC that was used for the BBS package I ran. Worse part, I’m begining to remember some of my code! 8O #-o

Maybe Ken can shed some light on how we can make it happen, who knows, we both might have been looking right at the answer all along! :wink: #-o