Jump to content

[SOLVED] Ajax HTTP Request pages cached


marf

Recommended Posts

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?

 

 

Link to comment
Share on other sites

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????

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.