Skip to content
Advertisement

Deleted images still being shown

For some reason, my website still showing images that were already deleted from the specified folder and I have no idea why that’s happening and how to solve that.

Process: When the button to delete all admins is pressed, it calls a PHP function that truncate the tables administration, adminimg and login, delete all images from a folder related to id’s on table administration with unlink(), and create a registry on administration table with id=1(auto_increment) and name=”abc”.

Problem: I have a jQuery function that display a specific admin information on textboxes, verify the value in the textbox for the adminID, and display the image associated to that id. After executing the process above, when i call the jQuery function, it display correctly the id=1 and name=”abc” but shows the deleted image associated to the admin with id=1 before truncate the tables.

jQuery function (if necessary)

JavaScript

Advertisement

Answer

If you’re sure that image isn’t there anymore then it’s caching issue and something like this would take care of it

JavaScript

However, you’re calling that function no matter what so I would suggest a onload/error check

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement