Jump to content

[SOLVED] ajax prob on other server


nadeemshafi9

Recommended Posts

in php 5 on my windows machine local my javascript uses ajax to call a php script which gens a rand and then teh javascript inserts it into the page

......

http.open('get', 'test.php');

.....

 

it works fine on my lcal machine

 

1 ...... 3443 ..... 4353 ..... 5654 .... 35656

 

 

on my live server php4 apache its like the scrippt output is generated once then the output is cached maybe because it keeps giving me he same number

 

3 .... 3.... 3.... 3.... 3..

Link to comment
https://forums.phpfreaks.com/topic/83667-solved-ajax-prob-on-other-server/
Share on other sites

in php 5 on my windows machine local my javascript uses ajax to call a php script which gens a rand and then teh javascript inserts it into the page

......

http.open('get', 'test.php');

.....

 

it works fine on my lcal machine

 

1 ...... 3443 ..... 4353 ..... 5654 .... 35656

 

 

on my live server php4 apache its like the scrippt output is generated once then the output is cached maybe because it keeps giving me he same number

 

3 .... 3.... 3.... 3.... 3..

 

SOLVED

 

header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT");

header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );

header( "Cache-Control: no-cache, must-revalidate" );

header( "Pragma: no-cache");

 

note: in the future; refer to this forum for your ajax questions. ;)

 

http://www.phpfreaks.com/forums/index.php/board,51.0.html

  • 2 weeks later...

Note: It is also possible to add an (unused by your code) random GET parameter on the end of the URL being requested so that each request appears to be different from the last.

 

ur a smart man i wish i had thoght of that seems like a solution to many problems lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.