We have a web portal in which each user appears with an image.
In a folder we have all the photos of the users. The name of the images is the ID of each user.
We want that if an image does not exist (the image of a user), a standard image appears in the image of that user.
The following code:
function (data, type, row, meta) {
return '<img src="../Fotos/' + data.dni + '.jpg" width="64" height="89" alt=""/>';
}
What I need is to check if the route exists (src="../Pictures/" + data.dni + ". jpg") and if it does not exist, change the route (this is easy).
What I can not do is check if the route exists (if the image is in the folder).
I tried to do it with an ajax call to a php file but it does not work for me.
Greetings.