Forum Moderators: open

Message Too Old, No Replies

IE Problem With AJAX

does not use updated information

         

dancran1220

5:43 pm on Aug 21, 2008 (gmt 0)

10+ Year Member



hey everyone,

ok....

i am using a JSP, server, database with Mochikit and AJAX.

Problem is when a user changes something in IE, it updates the database but for some reason it does not display the new information but the original. in firefox this all works perfectly. does IE have a problem with setAttribute and AJAX requests or is there something wrong with caching?

been stuck on this for two days now and have made no progress so any help would be awesome. the project is a chat program that pulls information and displays it on a web application but if you make any kind of change from the client (openfire chat server) or on the web app itself it does not make the change.

thanks again,
-dan

Fotiman

6:29 pm on Aug 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld. :)
Try changing the URL for your AJAX request to include some dynamic value to kill the cache. The date works well.

var d = new Date();
var url = "http://www.example.com?ck=" + d.getTime();

If you use that for each AJAX request, then each time it will be appending on a querystring with ck=n (where n is the current time stamp).

[edited by: Fotiman at 6:29 pm (utc) on Aug. 21, 2008]

dancran1220

6:39 pm on Aug 21, 2008 (gmt 0)

10+ Year Member



the problem is that my url goes to another class (.java) in the project.

function getNames()
{
log ("getNames called: ", timed);
var url = "ESignOutServlet";
var ajaxRequest = MochiKit.Async.doSimpleXMLHttpRequest(url, {'action':'getNames'});
ajaxRequest.addCallbacks(displayNames, handleAjaxError);
}

so when i do add the date i would get an error saying hey this isnt here.

dancran1220

6:41 pm on Aug 21, 2008 (gmt 0)

10+ Year Member



this is all local on the machine right now.

also dont know if it matters but i am using apache as well

Fotiman

7:50 pm on Aug 21, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Try this:

var ajaxRequest = MochiKit.Async.doSimpleXMLHttpRequest(url, {'action':'getNames', 'ck':(new Date()).getTime()});

dancran1220

12:55 pm on Aug 22, 2008 (gmt 0)

10+ Year Member



wow thanks so much this got it working perfectly! def recommend this to others who get stuck.

once again thanks a whole lot

-dan