How to clear the browser cache before sending an AJAX request

KHASHABAWY

New Member
I have been struggling for a while now. I am sending an AJAX request to a PHP script that modifies file names on the server (specifically images) and generates a list of the files as the HTML response. Everything works fine and the files are renamed as they should be, but no changes can be seen in the browser because the files 1.jpg that has been renamed to 2.jpg, and 2.jpg that is now 1.jpg have already been cached, and still display the original images even though it has been renamed on the server.So my question is how can I clear the cache before sending the request, I have tried appending a timestamp manually and via $.ajaxSetup as well as various php headers.I suspect these techniques don't work because the changes made are only to file names and not to the HTML response that the PHP script generates.
 
Back
Top