Networking, Programming and Graphics Tutorials

Prevent AJAX scripts from caching [2/2]

And now we can add this new value of time to the AJAX URL to get unique URL each time when AJAX script make request to the server side script.

var url='ajax.php?data='+str;
var date = new Date();
var timestamp = date.getTime();
url=url+'&time='+timestamp;
Please note that you have to get current time each time when you prepare to make each AJAX request. If you get time from current date in the beginning of script and later you want to use the value from this variable you will get identically values for time and your AJAX URLs.

For more explanation how AJAX work and how to use it you can visit our AJAX section of tutorials and to meet with AJAX features and possibilities.

Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - Prevent AJAX scripts from caching [2/2] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: ajax prevent caching  prevent ajax caching  prevent ajax from caching  prevent ajax from caching  prevent caching of ajax  prevent IE caching with ajax  ajax prevent caching  how to prevent caching in ajax  ajax prevent caching php  how to prevent caching ajax