marf Posted July 4, 2007 Share Posted July 4, 2007 I've been encountering this problem recently and only seems to be with IE6/7. Mozilla is fine. I have a basic HTML page, and I also have a simple AJAX HTTP Request script to load a list.php into a <div id="content"></div> The list just grabs a simple list from MySQL. It all works perfectly fine. The list shows up fine. I go into PHPMyAdmin and add another item to the list, and when I go back to the page in IE6/7 the old outdated list shows. I press refresh, and still nothing. I do the same in Mozilla and the list is updated. I found that if I go to Tools > Internet Options > Browsing history Settings, and check 'Check for new pages each time page is visited' it WILL work in IE7. However I can't tell everybody who visits my page to change this setting in their browser. Stupid thing is When this setting isn't changed, if I press refresh, it will refresh the HTML page, but it doesn't seem to refresh the list.php page that the AJAX is calling. Has anybody else encountered this? Maybe my javascript is poor, should I go to use prototype AJAX http req? would that give me better luck? Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 4, 2007 Share Posted July 4, 2007 what usually helps is put a random number behind the url you are requesting this prevents a page from being cached Quote Link to comment Share on other sites More sharing options...
marf Posted July 5, 2007 Author Share Posted July 5, 2007 I'm surprised, nobody else has encountered this? Should I be using Prototype or moo? Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted July 5, 2007 Share Posted July 5, 2007 moo or prototype can make javascripting easier if you take time to understand these frameworks but I am pretty sure you can solve it without using one of them Quote Link to comment Share on other sites More sharing options...
sayedsohail Posted July 5, 2007 Share Posted July 5, 2007 In you php page, where u are requesting data, include this one line, this will bring new data and also try to send a random number with you request from ajax script along with your xmlhttp or just include the code, i could help you to the point. <?php header('cache-contol: no-cache') the rest of your php code... ?> Where is the code???? Quote Link to comment Share on other sites More sharing options...
marf Posted July 5, 2007 Author Share Posted July 5, 2007 Figured out the problem.. Ahh I see sombody posted the same thing I jsut put <?php Header('Cache-Control: no-cache'); Header('Pragma: no-cache'); ?> before all the php on my list.php page. and it worked like a charm. Quote Link to comment Share on other sites More sharing options...
stockton Posted July 5, 2007 Share Posted July 5, 2007 I have successfully used the random number technique and recommend it. Quote Link to comment Share on other sites More sharing options...
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.