I am trying to check if a file exist or not but when I run the code it always go to error callback function even if the filename is the url of an existing file. Why does $.ajax
enter only the error callback function?
$.ajax({
url: filename,
type: 'GET',
dataType: 'text',
async: false,
cache: false,
success: function ()
{
alert('file is found.');
},
error: function ()
{
alert('file is not found.');
}
});