mardi 7 avril 2015

how to check image exist or not in my local system using ajax

We have image in D:\img\need.png. We need to know image exist or not.We tried like this:-- It's call error method always



$.ajax({
url:'D:/img/need.png',
type:'HEAD',
error: function(jqXHR, textStatus, errorThrown)
{
alert("file does not exist");
console.log(textStatus);
console.log(jqXHR);
console.log(errorThrown);
},
success: function()
{
alert("file exists do something here");//file exists do something here
}
});


Please guide me .What wrong in my code .How check file exist or not in my system using ajax call


Aucun commentaire:

Enregistrer un commentaire