The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

blowfish (6) [Avatar] Offline
I downloaded the code for chapter 2 (callbacktest.html) and it worked. so I modified it to do the function loadXMLDoc every 10 seconds. The script its calling (myscript) is checking a piece of data to see if it's changed. if it's changed, the script sends back a statement saying it's changed. if it's not, it says it's not.

this works fine with Mozilla browswers, I watch the output being displayed by callbacktest and it reports "no change" every 10 seconds. I reach over and change the data and callbacktest says "data has changed".

with Internet Explorer it's a different story. It never notices the data has changed. Not only that, it never notices if I change or delte myscript after the first call. Here are my assumptions:
1) IE uses ActiveXObject part of callbacktest and Mozilla uses XMLHttpRequest.
2) because when callbacktest is run with IE it just keeps reporting "no change", and acting as though it's stuck on it's first impression of the data, and cannot see the change, it never really calls myscript a second time. it's looking at some sort of cache. I got real confirmation of this when I sent up a new myscript to the server, and callbackttest under IE just kept right on acting and reporting as if it were calling the old script. I had to kill IE and restart it to get it to call the new script.

I'm wondering:
1) should I do some sort of "req.close" (if that's correct syntax) to flush things after each send.
2) should I NOT be instantiating a new req (request object) for each send but simply doing another send?
3) Have I got something set wrong in IE ?

Thanks for your time and suggestions.
Pascarello (208) [Avatar] Offline
Re: Please, a little help
It is cached:

In the commetns there is a line setRequestHeader something with a modified date, try adding that to your request.

kurinosuke (156) [Avatar] Offline
Re: Please, a little help
Adding a request parameter like "(new Date()).getTime()" would do the trick too.
blowfish (6) [Avatar] Offline
Re: Please, a little help
I cannot thank you enough. I've got it working now, thanks to your suggestions.