I need to check for an image coming from one of the positions of a JSON received via AJAX. Did you understand?
Is there a function equivalent to PHP's file_exists () in Javascript or jQuery?
$.ajax({
url:'http://www.example.com/verificafotos.json',
success: function(dados) {
$.each(dados, function(index,value){
value['titulo'];
value['imagem'];
if( SE O ARQUIVO EXISTIR (value['imagem'])) {
$('img').src(value['imagem']);
} else {
$('img').src('http://www.example.com/imagemalternativa.jpg');
}
});
}
});