How can i make this little function \"imageExists\" return wether the ajax request was successful or not?
function imageExists(path){
$.ajax({
url: p
Create a var to hold the response on a global level, then set async to false. You need to then set that var in the success or error function.
http://api.jquery.com/jQuery.ajax/
function imageExists(path){
myVar = null;
$.ajax({
url: path,
type: 'HEAD',
error:
function(){
myVar = false;
},
success:
function(){
myVar = true;
},
async: false
});
}