Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with FF and not updating image

Status
Not open for further replies.

snowboardr

Programmer
Joined
Feb 22, 2002
Messages
1,401
Location
PH
I created an image rotation script using AJAX and backend script, and it works PERFECT in IE... but in firefox it doesn't reload the image after the first "rotation"... which normally its the other way around where IE doesn't work and FF works... :(

I thought it was because of cache, which is maybe still be that... but I have put no cache in my meta tags... etc and in my script as well...

I have also added a random 5 digit number to the end of the image name so it "changes" per say.. but still no luck... my only other option would be to reload the page for firefox users... but that would kind of defeat the purpose of using AJAX.



Code:
// Reload users picture back in cell
var LoadPictureHTMLHttp=null;
function loadpicture() {
	LoadPictureHTMLHttp = createRequestObject();
    var url5="/rotate_image/show_picture.asp";
    LoadPictureHTMLHttp.open('GET', url5, true);
    LoadPictureHTMLHttp.onreadystatechange = loadPictureDone;
    LoadPictureHTMLHttp.send('');
}

function loadPictureDone() {
	if (LoadPictureHTMLHttp.readyState == 4) {
	  document.getElementById('loadimagehere').innerHTML = LoadPictureHTMLHttp.responseText;
   }
}


// rotate photo
var doRotateHTMLHttp=null;
function gogoGadgetRotate(strRotate) {
	doRotateHTMLHttp = createRequestObject();
    var url5="/rotate_image/rotate_picture.asp?rotate=" + strRotate;
    doRotateHTMLHttp.open('GET', url5, true);
    doRotateHTMLHttp.onreadystatechange = RotatePictureDone;
    doRotateHTMLHttp.send('');
}

function RotatePictureDone() {
	if (doRotateHTMLHttp.readyState == 4 || doRotateHTMLHttp.readyState=="complete") {
	 loadpicture();
	 
	 //attempt at refreshing it after 1.2 seconds doesnt work...
	 setTimeout('reupdate()',1200);
   }
}

function reupdate() {
	loadpicture();
}
 
Do you see any errors in the JavaScript console? Have you put alerts inside the loadPictureDone function to see what your server-side call is returning?

You say you've added a 5-digit param to the end of the image number - which is good... but you've not added anything to the end of the ASP call that is being fired off every time.

Also, have you git your function / asp calls round the right way? You seem to be calling "rotate_picture.asp" once, and "show_picture.asp" every 1.2 seconds? Surely this would be the other way round (call "show_picture" once, and "rotate_picture" every 1.2 seconds)... or do you just have stange naming conventions?

As an aside, if you've not done so already, consider installing Firebug.

It's a great, great extension for Firefox - not only does it give you fantastic debugging abilities, inspection abilities, and a great logging feature (which lets you inspect logged objects), but it also lets you watch XMLHTTP requests (both request and response) and see what is contained within them.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hey thanks for filling me in on that FF extension it is so awesome!! I wish i would have had this about 4 weeks ago when i started working on this huge Ajax project... oh well..

You can stop reading after the above, after i finished the last line of typing this post, I went to check my random number code again on the image... and well it seems i forgot a key word 'randomize' so the show_picture script was keeping the same number because of that :D ... it works!

Thanks for your help Dan.


Code:
It did let me in on what the problem is... with FF it is caching the show_picture.asp page... and also i took out the "auto reload feature" that you mentioned above... It was actually re-reloading the loadpicture function to see if that would fix the cache issue... because i figured thats what it was... I have had the same issue with a "security image" a while back...  Right after i first posted this thread, i added the random number on show_picture.asp?X but it appears its not changing that random number inside the show_picture.asp script on the image.... so for some reason its not updating that number... i figure its still a cache problem...   I have also set Cache in the asp code to not cache.

With still no luck. So I am not sure what can be done to fix this problem in FF, unless every user knows how to goto about:config in FF location bar and turn off cache... :D 

Jason

Army : Combat Engineer : 21B

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top