How can i make this little function \"imageExists\" return wether the ajax request was successful or not?
function imageExists(path){
$.ajax({
url: p
I believe you'll have to use synchronous mode and use a separate a variable for storing the return value.
function imageExists(path){
var isSuccess;
$.ajax({
url: path,
type: 'HEAD',
async: false,
error:
function(){
isSuccess = false;
return false;
},
success:
function(){
isSuccess = true;
return true;
}
});
return isSuccess;
}