OtagoHarbour 0 Posted April 30, 2013 Report Share Posted April 30, 2013 I used loadXMLDoc to load an XML file onto my web page. I then saved different contents to a file of the save name. When I reloaded the file with loadXMLDoc, I got the original contents instead of the new contents. I deleted the file and then save the new contents to the file with the same name. Reloading still gave me the old contents. I then changed the name of the file. This time loading the file with loadXMLDoc gave me the new contents. Does loadXMLDoc remember the contents that was loaded from a file with a given name and not bother reloading the contents if I present it with a file of the same name albeit different contents? After modifying the file, I looked at the XML code and the contents were modified after the first modification. Quote Link to post Share on other sites
jeffman 86 Posted April 30, 2013 Report Share Posted April 30, 2013 It sounds like the original doc is being cached. If you are using the GET request change it to POST. On the server side, you might send out these headers before sending your data: "Cache-Control: no-cache, must-revalidate""Pragma: no-cache" Quote Link to post Share on other sites
OtagoHarbour 0 Posted April 30, 2013 Author Report Share Posted April 30, 2013 It sounds like the original doc is being cached. If you are using the GET request change it to POST. On the server side, you might send out these headers before sending your data: "Cache-Control: no-cache, must-revalidate""Pragma: no-cache" Sorry. I should have mentioned that I am doing everything in JavaScript with some HTML. However you are certainly right about the caching causing the problem. I put the following code <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /><meta http-equiv="Pragma" content="no-cache" /> in the head section of index.html and that appears to have solved the problem. Thank you very much for you help,Peter. Quote Link to post Share on other sites
jeffman 86 Posted April 30, 2013 Report Share Posted April 30, 2013 (edited) I'm glad it helped. I did know you were doing JavaScript because you were using an AJAX object. The AJAX object has a place to specify GET or POST. It might still be worth looking at. If you borrowed the loadXMLDoc function here, notice that it's preprogrammed with GET. It doesn't have to be; and if I understand your situation, it probably should not be. Any server request that changes data on the server should be a POST request. Edited April 30, 2013 by Deirdre's Dad Quote Link to post Share on other sites
OtagoHarbour 0 Posted April 30, 2013 Author Report Share Posted April 30, 2013 I'm glad it helped. I did know you were doing JavaScript because you were using an AJAX object. The AJAX object has a place to specify GET or POST. It might still be worth looking at. If you borrowed the loadXMLDoc function here, notice that it's preprogrammed with GET. It doesn't have to be; and if I understand your situation, it probably should not be. Any server request that changes data on the server should be a POST request. Yes. That was the problem. Thanks again. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.