JSFiddle - React, Tailwind, and code Playground

JavaScript

function fileLoaded()
{
alert('There is the image');
}

function errorLoading()
{
alert('No image');
}

 var $image = 'http://www.mysite/images/example.jpg';


jQuery.ajax({
 url: $image,
     success: function(){
     fileLoaded();
 },
error: function(){
    errorLoading();
}
});