Jump to content

[SOLVED] Ajax problem


scuff

Recommended Posts

so I have this code that uses ajax to update every second and because internet caches I need to use urls with random queries on the end like this

       var randomnumber = Math.floor(Math.random()*1000001)
        var file = 'serverTime.php?dummy='+randomnumber; 
        ajaxRequest.open("GET", file, true);
ajaxRequest.send(null);

but the problem is, is that it creates a lot of files in the temporary internet files folder, so if they are on the page for along time it makes a lot of files and takes up room on their hard drive. Is there any way to do this without creating thousands of temporary files?

Link to comment
Share on other sites

You could send the correct headers in the PHP file to tell the client to not cache the content.  (Google "PHP don't cache" and something should come up.)

 

 

No guarantees that that will work 100% of the time with all browsers though.

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.